karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.95k stars 1.71k forks source link

Karma Code Coverage Exit Code is always 0 even when test coverage threshold is not met #3810

Open koobbbyyyy opened 2 years ago

koobbbyyyy commented 2 years ago

Hey there im looking out for some support,

Am working on a project and trying to make a script stop if the code Coverage don't meet the predetermined thresholds.

Just for testing reasons and to show the issue i set the threshold for statements to 100% in my karma.config.js

I would now expect the script that I run to fail/stop when it comes to the karma code coverage, but it just shows me an error that the thresholds are not met and then proceed with the next part of my script.

After doing some research I can see that the exit code of the code coverage is 0 no matter if it mets the predetermined threshold or not. I guess this should be 1 if the threshold is not met so it would fail, but it isnt.

Screenshot 2022-08-30 091413

Is there a workaround, configuration or any kind of solution for this problem?

Im working with "karma": "6.3.20" and karma-coverage": "2.2.0

Any Help is appreciated

disja commented 2 years ago

I have the same problem. A fix or workaround would be great.