Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: add shards support #48639

Merged
merged 18 commits into from
Jul 5, 2023
Merged
Prev Previous commit
Next Next commit
test_runner: added docs
  • Loading branch information
rluvaton committed Jul 3, 2023
commit d293da548399d7be4479e8fe241204e4cdeab6fa
20 changes: 20 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,26 @@ changes:
Configures the test runner to only execute top level tests that have the `only`
option set.

### `--shards`

<!-- YAML
added: REPLACEME
-->

Test suite shard to execute in a format of `<index>/<total>`, where

`index` is a positive integer, index of divided parts
`total` is a positive integer, total of divided part
This command will divide all tests files into `total` equal parts, and will run only those that happen to be in an `index` part.

For example, to split your tests suite into three parts, use this:

```sh
node --test --shard=1/3
node --test --shard=2/3
node --test --shard=3/3
rluvaton marked this conversation as resolved.
Show resolved Hide resolved
```

### `--throw-deprecation`

<!-- YAML
Expand Down
5 changes: 5 additions & 0 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,11 @@ changes:
If unspecified, subtests inherit this value from their parent.
**Default:** `Infinity`.
* `watch` {boolean} Whether to run in watch mode or not. **Default:** `false`.
* `shards` {Object} Running tests in a specific shard. **Default:** `undefined`.
* `index` {number} is a positive integer between 1 and `<total>` that specifies the index of the shard to run.
This option is _required_.
* `total` {number} is a positive that specifies the total number of shards to split the test files to.
This option is _required_.
* Returns: {TestsStream}

```mjs
Expand Down
Loading