Skip to content

Commit 9fac429

Browse files
alistair3149claude
andcommitted
Cap Vitest worker concurrency to keep the suite deterministic
Vitest 4 defaults its worker count to roughly the host CPU count. On high-core machines that are also running other work (e.g. several dev stacks), that oversubscribes the cores and starves test event loops, making timing-sensitive component tests (mount-then-query) flake intermittently. Vitest 2 did not exhibit this under the same suite. Cap maxWorkers so the run stays deterministic. CI runs on far fewer cores than this binds, so it is not slowed there; the cap only takes effect on big multi-core machines where the default oversubscribes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9b8f9c7 commit 9fac429

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

resources/ext.neowiki/vitest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ export default mergeConfig( viteConfig, defineConfig( {
55
test: {
66
environment: 'jsdom',
77
globals: true,
8+
// Cap worker concurrency. Vitest's default (~CPU count) oversubscribes
9+
// high-core machines that are also running other work, starving test
10+
// event loops and making timing-sensitive component tests flake. A fixed
11+
// cap keeps the suite deterministic without slowing CI, which runs on far
12+
// fewer cores than this binds.
13+
maxWorkers: 4,
14+
minWorkers: 1,
815
coverage: {
916
provider: 'v8',
1017
include: [ 'src' ],

0 commit comments

Comments
 (0)