Skip to content

Commit e1ada32

Browse files
committed
fix(tests): use forks pool in CI to prevent flaky worker timeouts
Switched from threads pool to forks pool in CI environments to prevent intermittent "Timeout waiting for worker to respond" errors. Forks provide better isolation and stability in CI, while threads remain faster for local development. - CI: forks pool (stable, no worker timeouts) - Local: threads pool (faster)
1 parent 75c74c5 commit e1ada32

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.config/vitest.config.mts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ const vitestConfig = defineConfig({
7070
],
7171
reporters: ['default'],
7272
// Optimize test execution for speed
73-
// Threads are faster than forks
74-
pool: 'threads',
73+
// Use forks in CI for stability, threads locally for speed
74+
pool: process.env.CI ? 'forks' : 'threads',
7575
poolOptions: {
7676
threads: {
7777
// Maximize parallelism for speed
@@ -95,6 +95,13 @@ const vitestConfig = defineConfig({
9595
isolate: false,
9696
useAtomics: true,
9797
},
98+
forks: {
99+
// CI: Use forks for stability (no worker timeout issues)
100+
singleFork: isCoverageEnabled,
101+
maxForks: isCoverageEnabled ? 1 : 16,
102+
minForks: isCoverageEnabled ? 1 : 4,
103+
isolate: true,
104+
},
98105
},
99106
// Increase timeouts to prevent worker timeout on slow CI environments
100107
teardownTimeout: 30_000,

0 commit comments

Comments
 (0)