@@ -445,18 +445,26 @@ in the [test runner execution model][] section.
445445
446446### Test runner execution model
447447
448- Each matching test file is executed in a separate child process. The maximum
449- number of child processes running at any time is controlled by the
450- [ ` --test-concurrency ` ] [ ] flag. If the child process finishes with an exit code
451- of 0, the test is considered passing. Otherwise , the test is considered to be a
452- failure. Test files must be executable by Node.js, but are not required to use
453- the ` node:test ` module internally.
448+ When process-level test isolation is enabled, each matching test file is
449+ executed in a separate child process. The maximum number of child processes
450+ running at any time is controlled by the [ ` --test-concurrency ` ] [ ] flag. If the
451+ child process finishes with an exit code of 0 , the test is considered passing.
452+ Otherwise, the test is considered to be a failure. Test files must be executable
453+ by Node.js, but are not required to use the ` node:test ` module internally.
454454
455455Each test file is executed as if it was a regular script. That is, if the test
456456file itself uses ` node:test ` to define tests, all of those tests will be
457457executed within a single application thread, regardless of the value of the
458458` concurrency ` option of [ ` test() ` ] [ ] .
459459
460+ When process-level test isolation is disabled, each matching test file is
461+ imported into the test runner process. Once all test files have been loaded, the
462+ top level tests are executed with a concurrency of one. Because the test files
463+ are all run within the same context, it is possible for tests to interact with
464+ each other in ways that are not possible when isolation is enabled. For example,
465+ if a test relies on global state, it is possible for that state to be modified
466+ by a test originating from another file.
467+
460468## Collecting code coverage
461469
462470> Stability: 1 - Experimental
@@ -933,7 +941,7 @@ the [`--experimental-test-snapshots`][] command-line flag.
933941Snapshot files are generated by starting Node.js with the
934942[ ` --test-update-snapshots ` ] [ ] command-line flag. A separate snapshot file is
935943generated for each test file. By default, the snapshot file has the same name
936- as ` process.argv[1] ` with a ` .snapshot ` file extension. This behavior can be
944+ as the test file with a ` .snapshot ` file extension. This behavior can be
937945configured using the ` snapshot.setResolveSnapshotPath() ` function. Each
938946snapshot assertion corresponds to an export in the snapshot file.
939947
@@ -1239,6 +1247,9 @@ added:
12391247 - v18.9.0
12401248 - v16.19.0
12411249changes:
1250+ - version: REPLACEME
1251+ pr-url: https://github.com/nodejs/node/pull/53927
1252+ description: Added the `isolation` option.
12421253 - version: v22.6.0
12431254 pr-url: https://github.com/nodejs/node/pull/53866
12441255 description: Added the `globPatterns` option.
@@ -1274,8 +1285,13 @@ changes:
12741285 * ` inspectPort ` {number|Function} Sets inspector port of test child process.
12751286 This can be a number, or a function that takes no arguments and returns a
12761287 number. If a nullish value is provided, each process gets its own port,
1277- incremented from the primary's ` process.debugPort ` .
1278- ** Default:** ` undefined ` .
1288+ incremented from the primary's ` process.debugPort ` . This option is ignored
1289+ if the ` isolation ` option is set to ` 'none' ` as no child processes are
1290+ spawned. ** Default:** ` undefined ` .
1291+ * ` isolation ` {string} Configures the type of test isolation. If set to
1292+ ` 'process' ` , each test file is run in a separate child process. If set to
1293+ ` 'none' ` , all test files run in the current process. ** Default:**
1294+ ` 'process' ` .
12791295 * ` only ` : {boolean} If truthy, the test context will only run tests that
12801296 have the ` only ` option set
12811297 * ` setup ` {Function} A function that accepts the ` TestsStream ` instance
@@ -1727,9 +1743,9 @@ added: v22.3.0
17271743
17281744* ` fn ` {Function} A function used to compute the location of the snapshot file.
17291745 The function receives the path of the test file as its only argument. If the
1730- ` process.argv[1] ` is not associated with a file (for example in the REPL),
1731- the input is undefined. ` fn() ` must return a string specifying the location of
1732- the snapshot file.
1746+ test is not associated with a file (for example in the REPL), the input is
1747+ undefined. ` fn() ` must return a string specifying the location of the snapshot
1748+ snapshot file.
17331749
17341750This function is used to customize the location of the snapshot file used for
17351751snapshot testing. By default, the snapshot filename is the same as the entry
0 commit comments