Karma exits with code 0 when the coverage threshold is below the configuration
See original GitHub issueHi,
I added this configuration to my karma.conf.js
type: 'html',
dir: 'test/coverage/',
check: {
global: {
statements: 85,
branches: 70,
functions: 85,
lines: 85
}
}
The logs work fine and if the thresholds are not met, I can see error logs in the terminal but karma always exit wit code 0. That affect my CI process that is not able to detect something is wrong.
The documentation says
If the thresholds are not met, karma will return failure.
and I’ve review the code and I’ve seen the plugin is setting the exit code to 1 so I’m not sure if it is a issue in karma-coverage or in karma itself.
I’m using : karma@5.1.1 karma-coverage@2.0.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
sapui5 - Karma-coverage exit code is always 0 even when test ...
Karma coverage reports the files that do not meet coverage threshold but the exit code is always 0, thus the pipeline does not...
Read more >Coverage - Karma test runner
Coverage. Karma can generate code coverage using awesome Istanbul. If you want to generate the coverage, you need to configure up to three...
Read more >karma-coverage-istanbul-reporter - npm package - Snyk
A karma reporter that uses the latest istanbul 1.x APIs (with full sourcemap support) to report coverage. For more information about how to...
Read more >Combined Unit & E2E Code Coverage: case study on a real ...
Evaluate the combined coverage from the unit test and parallel e2e jobs, fail the CI job if the coverage is below a defined...
Read more >karma-coverage-istanbul-reporter - npm
Start using karma-coverage-istanbul-reporter in your project by running ... with an exit code of 1 if not running in watch mode thresholds: ...
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 FreeTop 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
Top GitHub Comments
Solved with karma v5.2.0 (in combination with karma-coverage v2.0.3)
@matz3 It looks like your PR was already merged in master. I’ve tested it and it works fine. Looking forward for the next karma release. I’ll keep this issue open until then.
Thank you very much.