diff options
author | bcoe <bencoe@google.com> | 2020-10-23 05:56:28 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@github.com> | 2021-04-06 22:53:39 +0300 |
commit | 48e3f592a024243be5da5719828987d6d7ab4e11 (patch) | |
tree | ce56488668654b6fe355b92bb54f119036183392 /BUILDING.md | |
parent | ed79c986835f4234569f2f76d18120a3a490e483 (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 8e8f32fff6a..2f2e97de2a5 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. |