Skip to content

Commit ece434a

Browse files
authoredJan 11, 2023
fix: terminate workers, when closing process (#2645)
* feat: destroy workers, when closing process * chore: terminate all workers when closing pool
1 parent 9967645 commit ece434a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ export function createPool(ctx: Vitest): WorkerPool {
127127

128128
return {
129129
runTests: runWithFiles('run'),
130-
close: async () => {}, // TODO: not sure why this will cause Node crash: pool.destroy(),
130+
close: async () => {
131+
await Promise.all(pool.threads.map(w => w.terminate()))
132+
},
131133
}
132134
}
133135

0 commit comments

Comments
 (0)
Please sign in to comment.