-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test: make it easier to run tests for subsystems #15450
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,6 +404,13 @@ If you are updating tests and just want to run a single test to check it: | |
$ python tools/test.py -J --mode=release parallel/test-stream2-transform | ||
``` | ||
|
||
You can execute the entire suite of tests for a given subsystem | ||
by providing the name of a subsystem: | ||
|
||
```text | ||
$ python tools/test.py -J --mode=release child-process | ||
``` | ||
|
||
If you want to check the other options, please refer to the help by using | ||
the `--help` option | ||
|
||
|
@@ -420,6 +427,38 @@ $ ./node ./test/parallel/test-stream2-transform.js | |
Remember to recompile with `make -j4` in between test runs if you change code in | ||
the `lib` or `src` directories. | ||
|
||
##### Test Coverage | ||
|
||
It's good practice to ensure any code you add or change is covered by tests. | ||
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. Nit: Add sentence here along these lines:
|
||
You can do so by running the test suite with coverage enabled: | ||
|
||
```text | ||
$ ./configure --coverage && make coverage | ||
``` | ||
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. Nit: Maybe add something like this?
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. I think the whole suite runs with coverage enabled. So I'd be tempted to leave out this caveat unless folks to start noticing this behavior ... I'm also happy on the nyc/Istanbul side of things (which I have the commit bit for) to fix any issues that do consistently crop up. 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. I agree with @bcoe , I'd rather we treated coverage test failures as bugs if possible. |
||
|
||
A detailed coverage report will be written to `coverage/index.html` for | ||
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage. | ||
|
||
_Note that generating a test coverage report can take several minutes._ | ||
|
||
To collect coverage for a subset of tests you can set the `CI_JS_SUITES` and | ||
`CI_NATIVE_SUITES` variables: | ||
|
||
```text | ||
$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage | ||
``` | ||
|
||
The above command executes tests for the `child-process` subsystem and | ||
outputs the resulting coverage report. | ||
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. Sorry to keep nits coming on this, but one more: People new to using
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. No worries, appreciate the thorough review. I just pushed your recommendations, let me know what you think and I'll rebse. |
||
|
||
Running tests with coverage will create and modify several directories | ||
and files. To clean up afterwards, run: | ||
|
||
```text | ||
make coverage-clean | ||
./configure && make -j4. | ||
``` | ||
|
||
#### Step 7: Push | ||
|
||
Once you are sure your commits are ready to go, with passing tests and linting, | ||
|
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.
@Trott I revamped the notes about coverage a little bit, and to me the note feels appropriate in CONTRIBUTING.md now -- my thinking being it directs a contributor toward healthy practices.