From 58831f62c788e2ed27f426dd0fac62c445ce720a Mon Sep 17 00:00:00 2001 From: trevor-signal <131492920+trevor-signal@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:19:16 -0400 Subject: [PATCH] Default test-electron worker count to 1 locally --- ts/scripts/test-electron.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ts/scripts/test-electron.ts b/ts/scripts/test-electron.ts index c893d71af..f94b473da 100644 --- a/ts/scripts/test-electron.ts +++ b/ts/scripts/test-electron.ts @@ -17,9 +17,17 @@ import { parseUnknown } from '../util/schemas'; const ROOT_DIR = join(__dirname, '..', '..'); -const WORKER_COUNT = process.env.WORKER_COUNT - ? parseInt(process.env.WORKER_COUNT, 10) - : Math.min(8, cpus().length); +function getWorkerCount(): number { + if (process.env.WORKER_COUNT) { + return parseInt(process.env.WORKER_COUNT, 10); + } + if (process.env.CI) { + return Math.min(8, cpus().length); + } + return 1; +} + +const WORKER_COUNT = getWorkerCount(); const ELECTRON = join( ROOT_DIR,