From 0a642c6e57410b97417c46828ed6cd88362a35a5 Mon Sep 17 00:00:00 2001 From: hira Date: Tue, 5 Jul 2022 15:13:18 +0900 Subject: [PATCH] fix: crash with odd cpu counts (#1597) --- packages/vitest/src/node/pool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vitest/src/node/pool.ts b/packages/vitest/src/node/pool.ts index bc1cb0b9492e..46c038beec6f 100644 --- a/packages/vitest/src/node/pool.ts +++ b/packages/vitest/src/node/pool.ts @@ -23,7 +23,7 @@ const workerPath = pathToFileURL(resolve(distDir, './worker.mjs')).href export function createPool(ctx: Vitest): WorkerPool { const threadsCount = ctx.config.watch - ? Math.max(cpus().length / 2, 1) + ? Math.max(Math.floor(cpus().length / 2), 1) : Math.max(cpus().length - 1, 1) const maxThreads = ctx.config.maxThreads ?? threadsCount