Global coverage threshold should not exclude glob based thresholds #6165
Labels
feat: coverage
Issues and PRs related to the coverage feature
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
When using both global coverage thresholds and pattern based coverage thresholds, the "All files" tally reports correct numbers.
Setting the global thresholds based on this for the next run will fail the test run since the files matched by patterns are deducted from the global threshold numbers before checking if they pass.
Reproduction
Use this in test config:
src/a.ts:
src/b.ts:
Cover src/a.ts with a test and then run the tests:
You will see that it fails on global threshold, even though we have covered 100% of a.ts (and that passes), and 0% of b.ts, which results in a total of 50% coverage. And that is what the text reporter tells us.
However, the test run is failed as it only sees b.ts for the global thresholds, confusing users, implying the coverage numbers are somehow off.
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: