-
Notifications
You must be signed in to change notification settings - Fork 30.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
doc: instructions for generating coverage reports #15190
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,25 @@ To run the tests: | |
$ make test | ||
``` | ||
|
||
To run the tests and generate code coverage reports: | ||
|
||
```console | ||
$ ./configure --coverage | ||
$ make coverage | ||
``` | ||
|
||
This will generate coverage reports for both JavaScript and C++ tests (if you | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion:
|
||
only want to run the JavaScript tests then you do not need to run the first | ||
command `./configure --coverage`). | ||
|
||
The `make coverage` command downloads some tools to the project root directory | ||
and overwrites the `lib/` directory. To clean up after generating the coverage | ||
reports: | ||
|
||
```console | ||
make coverage-clean | ||
``` | ||
|
||
To build the documentation: | ||
|
||
This will build Node.js first (if necessary) and then use it to build the docs: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hey, thanks for writing it up!
From my limited experience with
make coverage
, it can have some quite surprising behavior. I'd suggest noting the following caveats in this section of the docs. Whether to note some or all of them is up to you!It doesn't work on macOS (I think? /cc @Trott)It does!lib/
directory is overwritten duringmake coverage
, and the original copied tolib_/
. I'd always suggest checking in thelib/
directory to Git before running coverage reports in case something awry happens. Seenode/Makefile
Lines 151 to 152 in 86e7c61
make coverage
run downloads some tools to the project root folder that are not.gitignore
d, which can be a nuisance.make coverage
(lib/
renaming, downloaded tools, raw and processed output) can be reverted withmake coverage-clean
make coverage
both builds and runs (i.e.make
+make test
); no way to split them properly unfortunately (one couldcoverage-build
first, but whencoverage-test
ing the JS files will get instrumented again, and thenode
binary rebuilt based on the instrumented JS files).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 for your review @TimothyGu. I will document
make coverage-clean
. I'm also wondering if we should handle setting clean as an option on the command line i.e.make coverage --clean=truemake coverage CLEAN=true
so that the coverage reports can be generated and the clean-up done in one run.I think this would be good but
coverage-clean
also removes thecoverage/
dir with the reports on so if passing the option--cleanCLEAN=true
then we would want to leave thecoverage/
dir intact. I don't think I see this as an issue as long as that dir is added to.gitignore
. What do you think?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.
Also, I just noticed that on the install of istanbul-merge and nyc, npm generates a
package-lock.json
which isn't removed bymake coverage-clean
.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.
That would be nice, but GNU Make doesn't support doing that AFAIK. But GNU Make does support environment variables so you can do
make coverage CLEAN=true
. PR welcome!Good catch! You can submit another pull request to change that if you'd like to, or if not please file an issue about it so we don't forget :)
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.
Great I will raise two other PRs and yes you're right my syntax was wrong on
make coverage CLEAN=true
:)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.
I'll wait to this to land before submitting the PR for handling passing clean as an option so that I can update the docs for that.