Skip to content

Commit

Permalink
test_runner: introduces test_concurrency flag
Browse files Browse the repository at this point in the history
adds the test_concurrency flag,
if set to true, runs all the tests in parallel

Fixes: nodejs#43837
  • Loading branch information
98lenvi committed Jul 23, 2022
1 parent 7ef069e commit 060c851
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,14 @@ Starts the Node.js command line test runner. This flag cannot be combined with
`--check`, `--eval`, `--interactive`, or the inspector. See the documentation
on [running tests from the command line][] for more details.

### `--test-concurrency`

<!-- YAML
added: REPLACEME
-->

Configures the test runner to run sub tests in parallel.

### `--test-only`

<!-- YAML
Expand Down
1 change: 0 additions & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const isTestRunner = getOptionValue('--test');
const testOnlyFlag = !isTestRunner && getOptionValue('--test-only');
// TODO(cjihrig): Use uv_available_parallelism() once it lands.
const rootConcurrency = isTestRunner ? cpus().length : 1;

const kShouldAbort = Symbol('kShouldAbort');


Expand Down
3 changes: 3 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
AddOption("--test",
"launch test runner on startup",
&EnvironmentOptions::test_runner);
AddOption("--test-concurrency",
"tests defined within a file run in parallel",
&EnvironmentOptions::test_concurrency);
AddOption("--test-only",
"run tests with 'only' option set",
&EnvironmentOptions::test_only,
Expand Down
1 change: 1 addition & 0 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class EnvironmentOptions : public Options {
std::string redirect_warnings;
std::string diagnostic_dir;
bool test_runner = false;
bool test_concurrency = false;
bool test_only = false;
bool test_udp_no_try_send = false;
bool throw_deprecation = false;
Expand Down

0 comments on commit 060c851

Please sign in to comment.