diff options
author | bcoe <bencoe@google.com> | 2020-10-23 05:56:28 +0300 |
---|---|---|
committer | Benjamin Coe <bencoe@google.com> | 2020-10-25 17:22:57 +0300 |
commit | ba907ff750ea18df743252b09f2c29d35ebe285d (patch) | |
tree | f110f5384e46eb2f1d95d74b59f4bf08eb14817b /BUILDING.md | |
parent | bae7ddecf709aa9c2c10d511ccecb3c13242471c (diff) |
test: refactor coverage logic
Cleanup logic in Makefile for coverage. Update BUILDING.md
accordingly.
PR-URL: https://github.com/nodejs/node/pull/35767
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'BUILDING.md')
-rw-r--r-- | BUILDING.md | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/BUILDING.md b/BUILDING.md index d208965c7c1..f339a20e31b 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -389,28 +389,32 @@ $ make coverage ``` A detailed coverage report will be written to `coverage/index.html` for -JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage -(if you only want to run the JavaScript tests then you do not need to run -the first command `./configure --coverage`). +JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage. -_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 (to run specific suites, e.g., `child-process`, in -isolation, unset the opposing `_SUITES` variable): +If you only want to run the JavaScript tests then you do not need to run +the first command (`./configure --coverage`). Run `make coverage-run-js`, +to execute JavaScript tests independently of the C++ test suite: ```text -$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage +$ make coverage-run-js ``` -The above command executes tests for the `child-process` subsystem and -outputs the resulting coverage report. +If you are updating tests and want to collect coverrage for a single test file +(e.g. `test/parallel/test-stream2-transform.js`): + +```text +$ make coverage-clean +$ NODE_V8_COVERAGE=coverage/tmp python tools/test.py test/parallel/test-stream2-transform.js +$ make coverage-report-js +``` -Alternatively, you can run `make coverage-run-js`, to execute JavaScript tests -independently of the C++ test suite: +You can collect coverage for the entire suite of tests for a given subsystem +by providing the name of a subsystem: ```text -$ CI_JS_SUITES=fs CI_NATIVE_SUITES= make coverage-run-js +$ make coverage-clean +$ NODE_V8_COVERAGE=coverage/tmp python tools/test.py -J --mode=release child-process +$ make coverage-report-js ``` The `make coverage` command downloads some tools to the project root directory. |