Skip to content

Commit

Permalink
fix: terminate workers, when closing process (#2645)
Browse files Browse the repository at this point in the history
* feat: destroy workers, when closing process

* chore: terminate all workers when closing pool
  • Loading branch information
sheremet-va committed Jan 11, 2023
1 parent 9967645 commit ece434a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vitest/src/node/pool.ts
Expand Up @@ -127,7 +127,9 @@ export function createPool(ctx: Vitest): WorkerPool {

return {
runTests: runWithFiles('run'),
close: async () => {}, // TODO: not sure why this will cause Node crash: pool.destroy(),
close: async () => {
await Promise.all(pool.threads.map(w => w.terminate()))
},
}
}

Expand Down

0 comments on commit ece434a

Please sign in to comment.