diff options
author | Benjamin Coe <ben@npmjs.com> | 2017-09-29 04:29:54 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2017-10-02 02:30:48 +0300 |
commit | 5be4dfaa13b0bb1ece79adc84822067a93b88600 (patch) | |
tree | 76f62aee116c6c833eeb82f4689b9bc1f6f21ad4 /CONTRIBUTING.md | |
parent | 200e783e6659fca744b23c366d3f95bfebe37dbf (diff) |
test: make it easier to run tests for subsystems
You can now run suites for subsystem using shorthand, e.g., http.
Switch to black-list of default test folders from white-list.
Tests run by 'make test', 'make coverage', etc., now configurable.
Stop running known_issues suite when collecting test coverage.
PR-URL: https://github.com/nodejs/node/pull/15450
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26b083b8673..03d2cc1a134 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. +You can do so by running the test suite with coverage enabled: + +```text +$ ./configure --coverage && make coverage +``` + +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. + +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, |