From bb2ad448dd1f978c9b7b8b5086e0c7078ea7ea96 Mon Sep 17 00:00:00 2001 From: hira Date: Tue, 5 Jul 2022 14:49:57 +0900 Subject: [PATCH] fix: fix crashes for creating thread pools on cpus with odd counts --- 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