Skip to content

Commit c299fdb

Browse files
il3vennovemberborn
andauthored
Allow parallel builds to be disabled
Fixes #2994. Co-authored-by: Mark Wubben <[email protected]>
1 parent 388ea53 commit c299fdb

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

docs/06-configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Arguments passed to the CLI will always take precedence over the CLI options con
5959
- `timeout`: Timeouts in AVA behave differently than in other test frameworks. AVA resets a timer after each test, forcing tests to quit if no new test results were received within the specified timeout. This can be used to handle stalled tests. See our [timeout documentation](./07-test-timeouts.md) for more options.
6060
- `nodeArguments`: Configure Node.js arguments used to launch worker processes.
6161
- `sortTestFiles`: A comparator function to sort test files with. Available only when using a `ava.config.*` file. See an example use case [here](recipes/splitting-tests-ci.md).
62+
- `utilizeParallelBuilds`: If `false`, disable [parallel builds](/docs/recipes/splitting-tests-ci.md) (default: true)
6263

6364
Note that providing files on the CLI overrides the `files` option.
6465

docs/recipes/splitting-tests-ci.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
AVA automatically detects whether your CI environment supports parallel builds using [ci-parallel-vars](https://www.npmjs.com/package/ci-parallel-vars). When parallel builds support is detected, AVA sorts the all detected test files by name, and splits them into chunks. Each CI machine is assigned a chunk (subset) of the tests, and then each chunk is run in parallel.
44

5+
To disable this feature, set `utilizeParallelBuilds` to `false` in your [AVA configuration](/docs/06-configuration.md#options).
6+
57
To better distribute the tests across the machines, you can configure a custom comparator function:
68

79
**`ava.config.js`:**
@@ -43,7 +45,7 @@ jobs:
4345
steps:
4446
# Check out code and perform setup steps
4547
# ...
46-
48+
4749
- name: Test
4850
run: npx ava
4951
env:

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export default async function loadCli() { // eslint-disable-line complexity
393393
}
394394

395395
let parallelRuns = null;
396-
if (isCi && ciParallelVars) {
396+
if (isCi && ciParallelVars && combined.utilizeParallelBuilds !== false) {
397397
const {index: currentIndex, total: totalRuns} = ciParallelVars;
398398
parallelRuns = {currentIndex, totalRuns};
399399
}

0 commit comments

Comments
 (0)