Skip to content

Commit 539e123

Browse files
trivikrtargos
authored andcommittedNov 1, 2018
doc: moved test instructions to BUILDING.md
Fixes: #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: #23949 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 3e512f1 commit 539e123

File tree

2 files changed

+33
-76
lines changed

2 files changed

+33
-76
lines changed
 

‎BUILDING.md

+30-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ file a new issue.
2424
* [Prerequisites](#prerequisites)
2525
* [Building Node.js](#building-nodejs-1)
2626
* [Running Tests](#running-tests)
27+
* [Running Coverage](#running-coverage)
2728
* [Building the documentation](#building-the-documentation)
2829
* [Building a debug build](#building-a-debug-build)
2930
* [Windows](#windows-1)
@@ -223,6 +224,13 @@ $ make -j4 test
223224
`make -j4 test` does a full check on the codebase, including running linters and
224225
documentation tests.
225226

227+
Make sure the linter does not report any issues and that all tests pass. Please
228+
do not submit patches that fail either check.
229+
230+
If you want to run the linter without running tests, use
231+
`make lint`/`vcbuild lint`. It will run both JavaScript linting and
232+
C++ linting.
233+
226234
If you are updating tests and just want to run a single test to check it:
227235

228236
```text
@@ -249,18 +257,35 @@ You can usually run tests directly with node:
249257
$ ./node ./test/parallel/test-stream2-transform.js
250258
```
251259

252-
Optionally, continue below.
260+
Remember to recompile with `make -j4` in between test runs if you change code in
261+
the `lib` or `src` directories.
262+
263+
#### Running Coverage
253264

254-
To run the tests and generate code coverage reports:
265+
It's good practice to ensure any code you add or change is covered by tests.
266+
You can do so by running the test suite with coverage enabled:
255267

256268
```console
257269
$ ./configure --coverage
258270
$ make coverage
259271
```
260272

261-
This will generate coverage reports for both JavaScript and C++ tests (if you
262-
only want to run the JavaScript tests then you do not need to run the first
263-
command `./configure --coverage`).
273+
A detailed coverage report will be written to `coverage/index.html` for
274+
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage
275+
(if you only want to run the JavaScript tests then you do not need to run
276+
the first command `./configure --coverage`).
277+
278+
_Generating a test coverage report can take several minutes._
279+
280+
To collect coverage for a subset of tests you can set the `CI_JS_SUITES` and
281+
`CI_NATIVE_SUITES` variables:
282+
283+
```text
284+
$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage
285+
```
286+
287+
The above command executes tests for the `child-process` subsystem and
288+
outputs the resulting coverage report.
264289

265290
The `make coverage` command downloads some tools to the project root directory
266291
and overwrites the `lib/` directory. To clean up after generating the coverage

‎doc/guides/contributing/pull-requests.md

+3-71
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ so that you can make the actual changes. This is where we will start.
1515
* [Commit message guidelines](#commit-message-guidelines)
1616
* [Step 5: Rebase](#step-5-rebase)
1717
* [Step 6: Test](#step-6-test)
18-
* [Test Coverage](#test-coverage)
1918
* [Step 7: Push](#step-7-push)
2019
* [Step 8: Opening the Pull Request](#step-8-opening-the-pull-request)
2120
* [Step 9: Discuss and Update](#step-9-discuss-and-update)
@@ -237,75 +236,7 @@ And on Windows:
237236
> vcbuild test
238237
```
239238

240-
(See the [Building guide][] for more details.)
241-
242-
Make sure the linter does not report any issues and that all tests pass. Please
243-
do not submit patches that fail either check.
244-
245-
If you want to run the linter without running tests, use
246-
`make lint`/`vcbuild lint`. It will run both JavaScript linting and
247-
C++ linting.
248-
249-
If you are updating tests and just want to run a single test to check it:
250-
251-
```text
252-
$ python tools/test.py -J --mode=release parallel/test-stream2-transform
253-
```
254-
255-
You can execute the entire suite of tests for a given subsystem
256-
by providing the name of a subsystem:
257-
258-
```text
259-
$ python tools/test.py -J --mode=release child-process
260-
```
261-
262-
If you want to check the other options, please refer to the help by using
263-
the `--help` option
264-
265-
```text
266-
$ python tools/test.py --help
267-
```
268-
269-
You can usually run tests directly with node:
270-
271-
```text
272-
$ ./node ./test/parallel/test-stream2-transform.js
273-
```
274-
275-
Remember to recompile with `make -j4` in between test runs if you change code in
276-
the `lib` or `src` directories.
277-
278-
#### Test Coverage
279-
280-
It's good practice to ensure any code you add or change is covered by tests.
281-
You can do so by running the test suite with coverage enabled:
282-
283-
```text
284-
$ ./configure --coverage && make coverage
285-
```
286-
287-
A detailed coverage report will be written to `coverage/index.html` for
288-
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage.
289-
290-
_Note that generating a test coverage report can take several minutes._
291-
292-
To collect coverage for a subset of tests you can set the `CI_JS_SUITES` and
293-
`CI_NATIVE_SUITES` variables:
294-
295-
```text
296-
$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage
297-
```
298-
299-
The above command executes tests for the `child-process` subsystem and
300-
outputs the resulting coverage report.
301-
302-
Running tests with coverage will create and modify several directories
303-
and files. To clean up afterwards, run:
304-
305-
```text
306-
make coverage-clean
307-
./configure && make -j4.
308-
```
239+
(See the [running tests][] section of Building guide for more details.)
309240

310241
### Step 7: Push
311242

@@ -661,7 +592,8 @@ If you want to know more about the code review and the landing process, see the
661592
[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
662593
[Collaborator Guide]: ../../../COLLABORATOR_GUIDE.md
663594
[guide for writing tests in Node.js]: ../writing-tests.md
595+
[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment
664596
[https://ci.nodejs.org/]: https://ci.nodejs.org/
665597
[IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4
666598
[Onboarding guide]: ../../onboarding.md
667-
[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment
599+
[running tests]: ../../../BUILDING.md#running-tests

0 commit comments

Comments
 (0)
Please sign in to comment.