diff options
author | Benjamin Coe <ben@npmjs.com> | 2017-09-29 04:29:54 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2017-10-18 06:46:29 +0300 |
commit | a8d1a56bec446118e0e658cd75f89452436f0ce7 (patch) | |
tree | 834e1a79fc328f972aa2accbc2deb462dbb9b857 /CONTRIBUTING.md | |
parent | 415821c309f47fd0b5817279ba02d4614a53e3a8 (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 06bcae31ba5..d78daedc802 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -405,6 +405,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 @@ -421,6 +428,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, |