Skip to content

Commit db9b6bb

Browse files
authoredJan 18, 2023
fix: don't terminate workers on Node 14 to not trigger fatal error (#2697)
1 parent 859e7f0 commit db9b6bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎packages/vitest/src/node/pool.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ export function createPool(ctx: Vitest): WorkerPool {
138138
return {
139139
runTests: runWithFiles('run'),
140140
close: async () => {
141-
await Promise.all(pool.threads.map(w => w.terminate()))
141+
// node before 16.17 has a bug that causes FATAL ERROR because of the race condition
142+
const nodeVersion = Number(process.version.match(/v(\d+)\.(\d+)/)?.[0].slice(1))
143+
if (nodeVersion >= 16.17)
144+
await Promise.all(pool.threads.map(w => w.terminate()))
142145
},
143146
}
144147
}

0 commit comments

Comments
 (0)
Please sign in to comment.