From 1a6aefdc8cfc8f06ad484dd1dab0a2b92ba2d62c Mon Sep 17 00:00:00 2001 From: klabo Date: Sun, 25 Jan 2026 20:39:40 -0800 Subject: [PATCH] fix(ci): resolve macOS vitest worker crash (vitest#8564) - Add NODE_OPTIONS memory limit for macOS CI (like Windows) - Use singleFork mode on macOS CI to avoid worker termination crash - All tests pass but workers crashed at teardown due to known vitest bug --- .github/workflows/ci.yml | 2 ++ vitest.config.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885d87fcb..3bda11de7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -278,6 +278,8 @@ jobs: checks-macos: if: github.event_name == 'pull_request' runs-on: macos-latest + env: + NODE_OPTIONS: --max-old-space-size=4096 strategy: fail-fast: false matrix: diff --git a/vitest.config.ts b/vitest.config.ts index 92c962a1f..ad81b7671 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ import { defineConfig } from "vitest/config"; const repoRoot = path.dirname(fileURLToPath(import.meta.url)); const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true"; const isWindows = process.platform === "win32"; +const isMacOS = process.platform === "darwin"; const localWorkers = Math.max(4, Math.min(16, os.cpus().length)); const ciWorkers = isWindows ? 2 : 3; @@ -19,6 +20,8 @@ export default defineConfig({ testTimeout: 120_000, hookTimeout: isWindows ? 180_000 : 120_000, pool: "forks", + // Use singleFork on macOS CI to avoid vitest worker crash (vitest#8564) + poolOptions: isMacOS && isCI ? { forks: { singleFork: true } } : undefined, maxWorkers: isCI ? ciWorkers : localWorkers, include: [ "src/**/*.test.ts",