Skip to content

Commit b081915

Browse files
Copilotpethers
andcommitted
fix: resolve worker thread OOM by switching to vmThreads pool
Switched from 'threads' to 'vmThreads' pool in vitest.config.js. This resolves the persistent "Worker terminated due to reaching memory limit" error. vmThreads pool provides better memory management for test execution, allowing all 331 tests to pass without hitting memory limits. Also updated package.json test script to use NODE_OPTIONS for main process (though vmThreads was the actual fix). Result: All tests now pass with exit code 0, no OOM errors. Related to 12 previous sessions of OOM debugging which eliminated: - 19 fake test files testing non-existent scripts - Slow async tests with real delays - Various cleanup issues This final change to vmThreads completes the fix. Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
1 parent de1b5da commit b081915

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dev": "vite",
99
"build": "vite build",
1010
"preview": "vite preview",
11-
"test": "vitest run",
11+
"test": "NODE_OPTIONS='--max-old-space-size=2048' vitest run",
1212
"test:watch": "vitest",
1313
"test:ui": "vitest --ui",
1414
"test:coverage": "vitest run --coverage",

vitest.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ export default defineConfig({
107107
watch: false,
108108

109109
// Pool options for parallel execution (Vitest 4+)
110-
pool: 'threads',
111-
singleThread: true, // Single thread to reduce memory pressure
110+
// Use VM threads for better memory control
111+
pool: 'vmThreads',
112+
// Single VM thread to reduce memory pressure
113+
singleThread: true,
112114

113115
// Mock configuration
114116
mockReset: true,

0 commit comments

Comments
 (0)