Coverage treshold wont work when --coverage is used
See original GitHub issue💥 Regression Report
When using --converage
on a CLI call in node package.json scripts
section
If the coverageThreshold
is not respected it doesn’t fail the test run
Last working version
Worked up to version: 19.0.2
Stopped working in version: 23.4.1
To Reproduce
Steps to reproduce the behavior:
in package.json
scripts
section:
test-unit-coverage= “ENVIRONMENT=test jest test/ --coverage”
after scripts
section:
"jest": {
"collectCoverage": true,
"coverageThreshold": {
"global": {
"functions": 100
}
}
}
Then run the script.
Expected behavior
To fail the test run when the threshold is not respected.
Link to repl or repo (highly encouraged)
Please provide either a repl.it demo or a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run npx envinfo --preset jest
Paste the results here:
System:
OS: macOS 10.14
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 6.3.0 - /usr/local/bin/npm
npmPackages:
jest: 23.4.1 => 23.4.1
Hope this will be enough, Thanks in advance !
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
When coverage goes down threshold is updated and the build ...
If you first get a 100% coverage and in the next build you get a 90%, the build will still be successful because...
Read more >Jest finds tests but doesn't collect coverage - Stack Overflow
I found that when upgrading jest (from 23 to 26) that i had this issue, and the resolution was to run with the...
Read more >What Is Branch Coverage & What Does It Really Tell You?
As you'll soon see, branch coverage is more nuanced than other metrics. A different metric can be at 100%, while branch coverage is...
Read more >Status Checks - Codecov
coverage: status: project: default: # basic target: auto threshold: 0% base: ... Use this on commits / PRs where you won't be uploading...
Read more >Why I set my unit test coverage threshold to 100% - Medium
True. However, I've learned that it's easier once you get used to it. Coverage does not meet global threshold: build fails. I won't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@paulosales thanks for your work on the subject ! unfortunately i do not have the same envirnonment now, and wouldn’t be able to reproduce what happened 2 years ago 😕
Hopefully it was just an env issue or an older version of jest 😃
i’ll let the other guys, answer for their part !
anyway thanks for your help on the matter !
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.