You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(workers): run serial tests after parallel workers
Tests matching the new `serial` config pattern are kept out of the
parallel workers. Once those exit, one more worker starts and runs the
serial tests one by one, inside the same run: bootstrapAll, teardownAll
and workers.result fire once and the exit code covers both parts.
Works with every --by strategy and combines with --grep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/configuration.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,7 @@ export const config = {
44
44
45
45
-`timeout` — default per-test timeout in seconds; a test is killed if it stops responding.
46
46
-`mocha` — [Mocha options](https://mochajs.org/#configuring-mocha-nodejs), including extra reporters. See [Reporters](/reports).
47
+
-`serial` — pattern for tests that must not run in parallel, e.g. `serial: '@serial'`. With `run-workers` they run one by one after all parallel workers finish. See [Serial tests](/parallel#serial-tests).
47
48
-`workerInitializationDelay` — delay in milliseconds between spinning up parallel workers to prevent CPU spikes and stagger browser startup. Defaults to `200`. Set to `0` to disable.
48
49
-`workerInitializationMaxDelay` — maximum total delay (in milliseconds) for worker initialization staggering. Defaults to `10000` (10 s). Set to `0` to disable capping.
Copy file name to clipboardExpand all lines: docs/parallel.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,34 @@ npx codeceptjs run-workers 4 --by pool
40
40
41
41
`--suites` is shorthand for `--by suite`.
42
42
43
+
### Serial tests
44
+
45
+
Some tests can't share the stage: they change global settings, reset data, or toggle a feature flag that other tests read. Mark them with a tag and set the `serial` pattern in config:
46
+
47
+
```js
48
+
// codecept.conf.js
49
+
exportconstconfig= {
50
+
serial:'@serial',
51
+
}
52
+
```
53
+
54
+
```js
55
+
Scenario('change account timezone @serial', ({ I }) => {
56
+
// ...
57
+
})
58
+
```
59
+
60
+
`run-workers` keeps matching tests out of the parallel workers. When those workers finish, one more worker starts and runs the serial tests one by one. It is still a single run: `bootstrapAll`, `teardownAll` and `event.workers.result` fire once, and the exit code covers both parts.
61
+
62
+
```
63
+
Test distribution:
64
+
Worker 1: 14 tests
65
+
Worker 2: 13 tests
66
+
Worker 3: 4 tests (serial)
67
+
```
68
+
69
+
`serial` is matched against the full test title the same way `--grep` is, so a tag on a `Feature` makes all its scenarios serial. It works with every `--by` strategy and combines with `--grep`: only serial tests that also match grep are run. With [multiple browsers](#multiple-browsers) each profile gets its own serial worker, started one after another.
70
+
43
71
### Multiple browsers
44
72
45
73
Define browser profiles under `multiple` in `codecept.conf.js`:
0 commit comments