summaryrefslogtreecommitdiff
path: root/BUILDING.md
diff options
context:
space:
mode:
authorKamat, Trivikram <16024985+trivikr@users.noreply.github.com>2018-10-28 22:59:56 -0700
committerKamat, Trivikram <16024985+trivikr@users.noreply.github.com>2018-10-30 23:00:49 -0700
commit8c244ddd98aab609cc60ee3f8f452278baa4ab94 (patch)
treec1fb184d3eefb02e7fbb7b00ea889ab700fdf207 /BUILDING.md
parentd690a87b8c71208a021cbcc21b09d27007c0f9dd (diff)
downloadandroid-node-v8-8c244ddd98aab609cc60ee3f8f452278baa4ab94.tar.gz
android-node-v8-8c244ddd98aab609cc60ee3f8f452278baa4ab94.tar.bz2
android-node-v8-8c244ddd98aab609cc60ee3f8f452278baa4ab94.zip
doc: moved test instructions to BUILDING.md
Fixes: https://github.com/nodejs/node/issues/23491 Duplicate test instructions were present in pull-requests.md Merged the instructions in BUILDING.md and provided a link from pull-requests.md PR-URL: https://github.com/nodejs/node/pull/23949 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'BUILDING.md')
-rw-r--r--BUILDING.md35
1 files changed, 30 insertions, 5 deletions
diff --git a/BUILDING.md b/BUILDING.md
index 0a81a7eb9c..5b5ee2d636 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -24,6 +24,7 @@ file a new issue.
* [Prerequisites](#prerequisites)
* [Building Node.js](#building-nodejs-1)
* [Running Tests](#running-tests)
+ * [Running Coverage](#running-coverage)
* [Building the documentation](#building-the-documentation)
* [Building a debug build](#building-a-debug-build)
* [Windows](#windows-1)
@@ -223,6 +224,13 @@ $ make -j4 test
`make -j4 test` does a full check on the codebase, including running linters and
documentation tests.
+Make sure the linter does not report any issues and that all tests pass. Please
+do not submit patches that fail either check.
+
+If you want to run the linter without running tests, use
+`make lint`/`vcbuild lint`. It will run both JavaScript linting and
+C++ linting.
+
If you are updating tests and just want to run a single test to check it:
```text
@@ -249,18 +257,35 @@ You can usually run tests directly with node:
$ ./node ./test/parallel/test-stream2-transform.js
```
-Optionally, continue below.
+Remember to recompile with `make -j4` in between test runs if you change code in
+the `lib` or `src` directories.
+
+#### Running Coverage
-To run the tests and generate code coverage reports:
+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:
```console
$ ./configure --coverage
$ make coverage
```
-This will generate coverage reports for both JavaScript and C++ tests (if you
-only want to run the JavaScript tests then you do not need to run the first
-command `./configure --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`).
+
+_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.
The `make coverage` command downloads some tools to the project root directory
and overwrites the `lib/` directory. To clean up after generating the coverage