-
Notifications
You must be signed in to change notification settings - Fork 12k
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
feat(@angular-devkit/build-angular): Switch to karma-coverage #17901
Conversation
packages/angular_devkit/build_angular/src/angular-cli-files/plugins/karma.ts
Outdated
Show resolved
Hide resolved
7a20487
to
6de7228
Compare
feb9f02
to
a7fef26
Compare
Because the coverage test is run asynchronously in a "runaway" promise, I had to do two things here to make the tests work:
I'm not very satisfied with both approaches, but after discussing with @filipesilva I think this is the best compromise. |
packages/angular_devkit/build_angular/src/karma/code-coverage_spec.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/karma/code-coverage_spec.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/angular-cli-files/plugins/karma.ts
Outdated
Show resolved
Hide resolved
expect(result.success).toBeTrue(); | ||
const karmaResults: TestResults = result.karmaResults as never; | ||
// exitCode is non-zero because coverage failed | ||
expect(karmaResults.exitCode).toBe(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, it means that currently with the CLI, there is no way to exit the process with a non zero error code when code coverage threshold is not met.
packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/karma.conf.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great.
Left a couple of comments.
Also, currently code-coverage in the console we display a summary, however it seems that it doesn't work with the new plugin. Can you take a look?
TOTAL: 3 SUCCESS
TOTAL: 3 SUCCESS
TOTAL: 3 SUCCESS
=============================== Coverage summary ===============================
Statements : 88.89% ( 8/9 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 85.71% ( 6/7 )
================================================================================
6077037
to
a33b3a5
Compare
Update: even though karma-coverage 2.0.3 was released to address the issue of
Since karma-coverage 2.0.3 no longer modifies the karma results in-place, the solution implemented in this PR is no longer applicable. |
@kyliau, any chance to get in touch with one of the Karma Googler’s to prioritise the above fixes? |
f69bef7
to
da462ea
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
packages/angular_devkit/build_angular/src/angular-cli-files/plugins/karma.ts
Outdated
Show resolved
Hide resolved
@googlebot I consent |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one small NIT.
09ccaf4
to
4d89628
Compare
This commit switches coverage tooling from karma-coverage-istanbul-reporter to karma-coverage since it's better supported. Closes angular#17757
4d89628
to
b162679
Compare
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. |
This commit switches coverage tooling from karma-coverage-istanbul-reporter
to karma-coverage since it's better supported.
Fixes #17757