-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: add script to check unit test coverage #4076
Conversation
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.
Thanks. You can see in package-scripts.js that we use a commands created by the presence of the COVERAGE
env var.
This is actually a set of many test runs, all of which generate coverage. The coverage data is then merged together to create the report.
- Please rename the script
coverage
- Change the script to be
cross-env COVERAGE=1 nps test.node && nyc report --reporter=text
. This will set theCOVERAGE
env var, run all the Node.js tests, then output a text report.
Rename the script to coverage and change the script
@boneskull |
@boneskull Could you please take a look at this PR? It has been approved but not yet merged. :) |
👋 coming back to this @HyunSangHan, are you still interested in working on this PR? As of #5027 there are again maintainers who can review it now. No worries if you no longer have time - but if you do that'd be great! (I do see that your last message was asking for review - unless directed otherwise we'll try to review it once we're ramped up enough!) |
@JoshuaKGoldberg |
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! I think we can figure out as a followup what, if anything, to do with this nice new report. Thanks! 🚀
Leaving open for @mochajs/maintenance-crew to take a look too.
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.
Description of the Change
Add script
npm start 'unit-coverage-report'
to check unit test coverage of Mocha.By using the script, unit test coverage can be checked in terminal like below:
Alternate Designs
The way to visualize seems ultimately better to be
Coveralls
.Benefits
Can easily check unit test coverage after writing moar tests to increase it.
Possible Drawbacks
None to knowledge
Applicable issues
Partial #3601