Skip to content

Commit

Permalink
doc: clarify concurrency model of test runner
Browse files Browse the repository at this point in the history
Refs: #47365
PR-URL: #47642
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
tniessen authored and danielleadams committed Jul 6, 2023
1 parent 46ee19c commit 02ed1a2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ Otherwise, the test is considered to be a failure. Test files must be
executable by Node.js, but are not required to use the `node:test` module
internally.

Each test file is executed as if it was a regular script. That is, if the test
file itself uses `node:test` to define tests, all of those tests will be
executed within a single application thread, regardless of the value of the
`concurrency` option of [`test()`][].

## Collecting code coverage

When Node.js is started with the [`--experimental-test-coverage`][]
Expand Down Expand Up @@ -718,7 +723,8 @@ changes:
* `options` {Object} Configuration options for running tests. The following
properties are supported:
* `concurrency` {number|boolean} If a number is provided,
then that many files would run in parallel.
then that many test processes would run in parallel, where each process
corresponds to one test file.
If `true`, it would run `os.availableParallelism() - 1` test files in
parallel.
If `false`, it would only run one test file at a time.
Expand Down Expand Up @@ -782,7 +788,7 @@ changes:
* `options` {Object} Configuration options for the test. The following
properties are supported:
* `concurrency` {number|boolean} If a number is provided,
then that many tests would run in parallel.
then that many tests would run in parallel within the application thread.
If `true`, it would run `os.availableParallelism() - 1` tests in parallel.
For subtests, it will be `Infinity` tests in parallel.
If `false`, it would only run one test at a time.
Expand Down Expand Up @@ -1683,7 +1689,7 @@ changes:
* `options` {Object} Configuration options for the subtest. The following
properties are supported:
* `concurrency` {number|boolean|null} If a number is provided,
then that many tests would run in parallel.
then that many tests would run in parallel within the application thread.
If `true`, it would run all subtests in parallel.
If `false`, it would only run one test at a time.
If unspecified, subtests inherit this value from their parent.
Expand Down

0 comments on commit 02ed1a2

Please sign in to comment.