Skip to content

Commit 7e35354

Browse files
committed
refactor: optimize vitest config
1 parent 9b2f319 commit 7e35354

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

vitest.config.mts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ import path from 'path'
3030
export default defineConfig({
3131
test: {
3232
globals: true,
33+
// Enable parallel test execution with threads (optimized for 10-core CPU)
34+
pool: 'threads',
35+
poolOptions: {
36+
threads: {
37+
// Use more threads for better parallelization on multi-core systems
38+
minThreads: 6,
39+
maxThreads: 10,
40+
// Isolate environment for each test file for better test isolation
41+
isolate: true
42+
}
43+
},
44+
// Increase max concurrency for better parallelization
45+
maxConcurrency: 8,
3346
watchTriggerPatterns: [
3447
{
3548
// matches any file inside the __testfixtures__ directory
@@ -51,7 +64,13 @@ export default defineConfig({
5164
include: ['**/__tests__/**/*.test.tsx'],
5265
environment: 'jsdom',
5366
setupFiles: './vitest.setup.ts',
54-
name: { label: 'web', color: 'blue' }
67+
name: { label: 'web', color: 'blue' },
68+
// Optimize jsdom environment
69+
environmentOptions: {
70+
jsdom: {
71+
resources: 'usable'
72+
}
73+
}
5574
}
5675
},
5776
{

0 commit comments

Comments
 (0)