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
This commit is contained in:
klabo 2026-01-25 20:39:40 -08:00 committed by Joel Klabo
parent 07d2fb540e
commit 1a6aefdc8c
2 changed files with 5 additions and 0 deletions

View File

@ -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:

View File

@ -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",