diff --git a/doc/api/cli.md b/doc/api/cli.md index 9492aa2204dd6b..d8282ee0250367 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2249,6 +2249,19 @@ Starts the Node.js command line test runner. This flag cannot be combined with See the documentation on [running tests from the command line][] for more details. +### Environment Variable + +The following environment variable is available when running tests with the `--test` flag: + +`NODE_TEST_WORKER_ID`: + +* Parallel Test Runs: If tests are executed in parallel (using the `--test` flag + alone or with the `--experimental-test-isolation=process` flag), this variable is assigned + a unique number ranging from `1` to `N`, where `N` represents the total number of test files being processed. + +* Isolated Test Runs: When tests are run in isolation (using the `--experimental-test-isolation=none` flag), + this variable is always set to `1`. + ### `--test-concurrency`