New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular Cli: 6.0.1 code coverage thresholds not failing ng test task #10940
Comments
We are running into the same issue. Status code of the |
@filipesilva can you please let us know if you think this is an issue with cli? if so is there a workaround? |
Our team is also experiencing the same issue. |
My team also has this issue and it's fairly integral to our workflow. Hope this can get prioritized, thanks! |
Same issue here, currently preventing our regular CI workflow from running as expected |
I am also facing the same issue with cli 1.7.4 |
any update on the issue please? it is preventing us from upgrading to version 6.x. |
After upgrading from cli version 1.6.6 to 6.0.8, it looks like the exit status of the process is always 0, even if the code coverage thresholds are not met. An example from our docker build ->
Angular CLI information
For the interim, I'm going to attempt to write this to a file, and fail our build if I can scrape the error message. But, it's definitely not ideal. |
Same issue with the exit code being 0. The output:
And the
|
@hansl Is this fixed? We tried the latest rc version but didn't work for us. |
@codeNoobie you need to install latest version of the: |
"@angular-devkit/build-angular": "~0.7.1", |
@alexw10 We have tried that but it doesn't seem to work. Could you please check again if this issue has been fixed ? |
Hi there, The same issue is still persist for us as well, using Can you please check? |
After trying everything, I was able to make it work by upgrading coverageIstanbulReporter: {
verbose: true,
dir: require('path').join(__dirname, 'coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true,
thresholds: {
emitWarning: false, // <- this is important to make karma fail
global: {
statements: 85,
lines: 85,
branches: 85,
functions: 85
}
}
} Also, don't forget to set singleRun: config.angularCli && config.angularCli.codeCoverage |
This is not fixed. |
Found a fix for this: Remove It seems that |
Thank you!
I've tried it and it did the trick for us!
Eóin Martin <notifications@github.com> ezt írta (időpont: 2018. nov. 6., K,
16:10):
… Found a fix for this:
Remove coverage-istanbul from your reporters array in karma.conf and it
will use the correct exit code.
It seems that coverage-istanbul is registered automatically when
codeCoverage is set to true in your configuration and when it was being
called twice it was causing issues.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#10940 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ao8vKcmC0cD9XaB6Hlg0fOanvZbh8uyxks5usaZTgaJpZM4UGznr>
.
|
Hi, when using This can be done by setting the parallelOptions: {
executors: 4, // Defaults to cpu-count - 1
shardStrategy: 'description-length',
aggregatedReporterTest: '/coverage|istanbul/'
}, It is important to note, that the RegExp needs to be passed as a string. |
Apart from that I am unable to replicate the issue that when the code coverage is below the threshold it is not existing with a non zero error code. npm run test -- --code-coverage --watch=false
> ng test "--code-coverage" "--watch=false"
30% building 16/16 modules 0 active20 06 2019 08:52:16.417:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
20 06 2019 08:52:16.425:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
20 06 2019 08:52:16.435:INFO [launcher]: Starting browser ChromeHeadless 20 06 2019 08:52:22.262:INFO [HeadlessChrome 75.0.3770 (Windows 10.0.0)]: Connected on socket PibQn-_TY8h99UXSAAAA with id 61228163
HeadlessChrome 75.0.3770 (Windows 10.0.0): Executed 5 of 5 SUCCESS (0.32 secs / 0.249 secs)
TOTAL: 5 SUCCESS
=============================== Coverage summary ===============================
Statements : 100% ( 10/10 )
Branches : 100% ( 0/0 )
Functions : 100% ( 3/3 )
Lines : 100% ( 7/7 )
================================================================================
20 06 2019 08:52:25.723:ERROR [reporter.coverage-istanbul]: Coverage for statements (100%) does not meet global threshold (200%)
TOTAL: 5 SUCCESS
TOTAL: 5 SUCCESS
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eight-pwa@0.0.0 test: `ng test "--code-coverage" "--watch=false"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eight-pwa@0.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alag\AppData\Roaming\npm-cache\_logs\2019-06-20T06_52_26_003Z-debug.log What is slightly confusing is that the coverage error is appearing below the |
Hi I'll leave this this a couple of days open to see if anyone provide a reproduction were when using At this point, I am unable to replicate any of the issues reported. Thanks. |
Closing, as no further details provided. If the issue persists kindly open a new issue with a reproduction. Thanks. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
After upgrade to Angular Cli 6.x the code coverage thresholds enforced by the karma-coverage-istanbul-reporter do not make the testing command fail with emitWarning set to false as they used to when using Angular Cli 6.0.1.
Versions
Repro steps
Observed behavior
Desired behavior
The test command should be failing when thresholds not met as it used to.
Mention any other details that might be useful (optional)
Tried with both karma@1.7.x and 2.x, reporter version 0.x and 1.x. Seems that stops working as soon as the upgrade of Angular Client is done. Same repo with Angular Client 1.7 behaves correctly.
The text was updated successfully, but these errors were encountered: