jest-it-up icon indicating copy to clipboard operation
jest-it-up copied to clipboard

Support for non-global code coverage thresholds

Open thall90 opened this issue 2 years ago • 5 comments
trafficstars

This PR adds support for non-global code coverage thresholds in the form of threshold-keys, which should resolve #13.

thall90 avatar May 17 '23 01:05 thall90

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (66018e5) 100.00% compared to head (1f32256) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #18   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines           69        81   +12     
=========================================
+ Hits            69        81   +12     
Impacted Files Coverage Δ
lib/getChanges.js 100.00% <100.00%> (ø)
lib/getData.js 100.00% <100.00%> (ø)
lib/getNewThresholds.js 100.00% <100.00%> (ø)
lib/index.js 100.00% <100.00%> (ø)
lib/outputChanges.js 100.00% <100.00%> (ø)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar May 28 '23 00:05 codecov-commenter

@thall90 are you going to complete it?

vvscode avatar Nov 08 '23 05:11 vvscode

@rbardini @jimmywarting @vvscode I apologize for the delay - life's been busy, to say the least.

@rbardini I agree that bumping up coverage for all threshold paths by default makes sense. I'll have that change along with all of the requested changes pushed tomorrow 👍

thall90 avatar Nov 24 '23 23:11 thall90

@rbardini While wrapping up changes to this PR, I found what appears to be a pretty big miss in my original changes:

In getNewThresholds we're using the total value from the coverage-summary.json for both global and non-global coverage threshold paths, which doesn't seem right, since Jest only checks coverage for files that match glob provided in the threshold path in non-global cases.

My belief is that we will need to implement similar functionality to Jest's coverage threshold checking in order to verify whether a given threshold path's values should be bumped, since Jest doesn't appear to expose the result of their threshold checks.

Happy to move forward with implementing these changes as well, but I wanted to get your take on the problem and the approach first.

Thanks in advance!

thall90 avatar Nov 26 '23 18:11 thall90

I just implemented some workaround script for my project and it works in a way

  1. take config
  2. put 100% coverage limit for all non-global items
  3. run tests
  4. analyze output (jest says for every line, that doesn't satisfy expectations what's the current coverage)
  5. update config with received data

vvscode avatar Nov 26 '23 19:11 vvscode