Skip to content
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

chore: update how we track coverage during unit tests #5779

Merged
merged 4 commits into from Apr 30, 2020

Conversation

jackfranklin
Copy link
Collaborator

The old method of tracking coverage was causing issues. If a test failed
on CI, that test's failure would be lost because the test failing would
in turn cause the coverage to fail, but the process.exit(1) in the
coverage code caused Mocha to not output anything useful.

Instead the coverage checker now:

  • tracks the coverage in memory in a Map (this hasn't changed)
  • after all tests, writes that to disk in test/coverage.json (which is
    gitignored)
  • we then run a single Mocha test that asserts every method was called.

This means if the test run fails, the build will fail and give the error
about that test run, and that output won't be lost when the coverage
then fails too.

Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comments

@googlebot
Copy link

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 @googlebot I consent. in this pull request.

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 cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@jackfranklin
Copy link
Collaborator Author

jackfranklin commented Apr 30, 2020

Added the CLA label as the two commiters are myself + Mathias :). I think the rebase I did against master threw the googlebot off.

jackfranklin and others added 4 commits April 30, 2020 12:44
The old method of tracking coverage was causing issues. If a test failed
on CI, that test's failure would be lost because the test failing would
in turn cause the coverage to fail, but the `process.exit(1)` in the
coverage code caused Mocha to not output anything useful.

Instead the coverage checker now:

* tracks the coverage in memory in a Map (this hasn't changed)
* after all tests, writes that to disk in test/coverage.json (which is
gitignored)
* we then run a single Mocha test that asserts every method was called.

This means if the test run fails, the build will fail and give the error
about that test run, and that output won't be lost when the coverage
then fails too.
Co-Authored-By: Mathias Bynens <mathias@qiwi.be>
@googlebot
Copy link

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 @googlebot I consent. in this pull request.

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 cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@jackfranklin jackfranklin merged commit 5518bac into master Apr 30, 2020
@jackfranklin jackfranklin deleted the coverage-fix branch April 30, 2020 12:00
TimvdLippe added a commit to TimvdLippe/puppeteer that referenced this pull request Jun 12, 2020
The test command referenced the task `npm run coverage`, which
was renamed to `unit-with-coverage` in puppeteer#5779
@TimvdLippe TimvdLippe mentioned this pull request Jun 12, 2020
mathiasbynens pushed a commit that referenced this pull request Jun 15, 2020
The `test` command referenced the task `npm run coverage`, which was renamed to `unit-with-coverage` in #5779.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants