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:
parent
07d2fb540e
commit
1a6aefdc8c
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -278,6 +278,8 @@ jobs:
|
|||||||
checks-macos:
|
checks-macos:
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { defineConfig } from "vitest/config";
|
|||||||
const repoRoot = path.dirname(fileURLToPath(import.meta.url));
|
const repoRoot = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
||||||
const isWindows = process.platform === "win32";
|
const isWindows = process.platform === "win32";
|
||||||
|
const isMacOS = process.platform === "darwin";
|
||||||
const localWorkers = Math.max(4, Math.min(16, os.cpus().length));
|
const localWorkers = Math.max(4, Math.min(16, os.cpus().length));
|
||||||
const ciWorkers = isWindows ? 2 : 3;
|
const ciWorkers = isWindows ? 2 : 3;
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ export default defineConfig({
|
|||||||
testTimeout: 120_000,
|
testTimeout: 120_000,
|
||||||
hookTimeout: isWindows ? 180_000 : 120_000,
|
hookTimeout: isWindows ? 180_000 : 120_000,
|
||||||
pool: "forks",
|
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,
|
maxWorkers: isCI ? ciWorkers : localWorkers,
|
||||||
include: [
|
include: [
|
||||||
"src/**/*.test.ts",
|
"src/**/*.test.ts",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user