Skip to content

Commit 431af29

Browse files
committed
Cap Vitest forks to avoid timeout on heavy tests
1 parent cdaf527 commit 431af29

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

vitest.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { availableParallelism } from 'os';
12
import { defineConfig } from 'vitest/config';
23
import react from '@vitejs/plugin-react';
34
import { resolve } from 'path';
@@ -15,6 +16,13 @@ export default defineConfig({
1516
environment: 'jsdom',
1617
setupFiles: ['./src/setupTests.ts', 'dotenv/config'],
1718
globalSetup: './src/vitest.global-setup.ts',
19+
poolOptions: {
20+
forks: {
21+
// cap forks below core count to avoid timeout from resource overload on heavy tests
22+
maxForks: Math.ceil(availableParallelism() / 2),
23+
minForks: 1,
24+
},
25+
},
1826
coverage: {
1927
reporter: ['text', 'json', 'html'],
2028
exclude: ['node_modules/', 'src/setupTests.ts'],

0 commit comments

Comments
 (0)