chore(build,test): split desktop/mobile from default build; share vitest worker budget
- pnpm build now excludes @fusion/desktop and @fusion/mobile by default (recursive build still available as pnpm build:all). Saves time on workspace-wide builds that don't need the native shells. - Hoist the per-package max-worker computation into a shared packages/core/src/__test-utils__/vitest-workers.ts util. Every vitest.config.ts now calls computeMaxWorkers(), which honors VITEST_MAX_WORKERS, FUSION_TEST_TOTAL_WORKERS, and a per-config defaultCap, clamped to cpus-1. - pnpm test sets VITEST_MAX_WORKERS=2 so the workspace run keeps total fan-out modest with --workspace-concurrency=2. - Switch dashboard vitest pool from forks to threads so jsdom/React suites share a V8 heap instead of duplicating ~500MB per worker. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -446,7 +446,8 @@ fn skills install firebase/agent-skills # Install agent skills
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm install # Install dependencies
|
pnpm install # Install dependencies
|
||||||
pnpm build # Build all packages
|
pnpm build # Build default workspace packages (excludes desktop/mobile)
|
||||||
|
pnpm build:all # Build all packages (including desktop/mobile)
|
||||||
pnpm dev dashboard # Run dashboard + AI engine
|
pnpm dev dashboard # Run dashboard + AI engine
|
||||||
pnpm dev:ui # Dashboard only (no AI engine)
|
pnpm dev:ui # Dashboard only (no AI engine)
|
||||||
pnpm lint # Lint all packages
|
pnpm lint # Lint all packages
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ Thanks for contributing to Fusion.
|
|||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build all packages
|
### Build workspace packages
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm build
|
pnpm build # default build (excludes desktop/mobile)
|
||||||
|
pnpm build:all # full recursive build including desktop/mobile
|
||||||
```
|
```
|
||||||
|
|
||||||
## Workspace Package Overview
|
## Workspace Package Overview
|
||||||
@@ -44,7 +45,8 @@ pnpm dev # build + run CLI entrypoint in dev mode
|
|||||||
pnpm dev:ui # dashboard dev server only
|
pnpm dev:ui # dashboard dev server only
|
||||||
pnpm lint # lint all packages
|
pnpm lint # lint all packages
|
||||||
pnpm test # workspace test suite (clean-worktree compatible)
|
pnpm test # workspace test suite (clean-worktree compatible)
|
||||||
pnpm build # workspace builds
|
pnpm build # workspace builds (excludes desktop/mobile)
|
||||||
|
pnpm build:all # full workspace build (includes desktop/mobile)
|
||||||
pnpm verify:workspace # canonical lint -> test -> build verification gate
|
pnpm verify:workspace # canonical lint -> test -> build verification gate
|
||||||
pnpm typecheck # workspace typechecks
|
pnpm typecheck # workspace typechecks
|
||||||
```
|
```
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -20,13 +20,15 @@
|
|||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"sync:fusion-skill": "node scripts/sync-fusion-skill-tools.mjs",
|
"sync:fusion-skill": "node scripts/sync-fusion-skill-tools.mjs",
|
||||||
"sync:fusion-skill:check": "node scripts/sync-fusion-skill-tools.mjs --check",
|
"sync:fusion-skill:check": "node scripts/sync-fusion-skill-tools.mjs --check",
|
||||||
"build": "pnpm -r build",
|
"build": "pnpm -r --filter=!@fusion/desktop --filter=!@fusion/mobile build",
|
||||||
|
"build:all": "pnpm -r build",
|
||||||
"verify:workspace": "pnpm lint && pnpm test && pnpm build",
|
"verify:workspace": "pnpm lint && pnpm test && pnpm build",
|
||||||
"build:exe": "pnpm build && pnpm --filter @runfusion/fusion build:exe",
|
"build:exe": "pnpm build && pnpm --filter @runfusion/fusion build:exe",
|
||||||
"build:exe:all": "pnpm build && pnpm --filter @runfusion/fusion build:exe:all",
|
"build:exe:all": "pnpm build && pnpm --filter @runfusion/fusion build:exe:all",
|
||||||
"test": "pnpm sync:fusion-skill:check && pnpm -r --workspace-concurrency=2 test",
|
"test": "pnpm sync:fusion-skill:check && FUSION_TEST_TOTAL_WORKERS=4 FUSION_TEST_CONCURRENCY=2 pnpm -r --workspace-concurrency=2 test",
|
||||||
"test:serial": "pnpm -r --workspace-concurrency=1 test",
|
"test:serial": "FUSION_TEST_TOTAL_WORKERS=4 FUSION_TEST_CONCURRENCY=1 pnpm -r --workspace-concurrency=1 test",
|
||||||
"test:fast": "pnpm -r --workspace-concurrency=4 test",
|
"test:fast": "FUSION_TEST_TOTAL_WORKERS=4 FUSION_TEST_CONCURRENCY=4 pnpm -r --workspace-concurrency=4 test",
|
||||||
|
"test:locked": "node scripts/test-with-lock.mjs",
|
||||||
"test:build": "pnpm --filter @fusion/dashboard test:build",
|
"test:build": "pnpm --filter @fusion/dashboard test:build",
|
||||||
"test:isolated": "node scripts/check-test-isolation.mjs --before && pnpm test && node scripts/check-test-isolation.mjs",
|
"test:isolated": "node scripts/check-test-isolation.mjs --before && pnpm test && node scripts/check-test-isolation.mjs",
|
||||||
"test:check-isolation": "node scripts/check-test-isolation.mjs",
|
"test:check-isolation": "node scripts/check-test-isolation.mjs",
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
import { cpus } from "node:os";
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 so high-core dev machines don't spawn 27+ workers per
|
const maxWorkers = computeMaxWorkers();
|
||||||
// package — that saturates the box when multiple workspace packages test
|
|
||||||
// concurrently or when the dashboard has agents running tests in parallel.
|
|
||||||
// Override with VITEST_MAX_WORKERS for explicit fast/serial runs.
|
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
45
packages/core/src/__test-utils__/vitest-workers.ts
Normal file
45
packages/core/src/__test-utils__/vitest-workers.ts
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import { cpus } from "node:os";
|
||||||
|
|
||||||
|
interface ComputeMaxWorkersOptions {
|
||||||
|
defaultCap?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shared worker-budget computation for every package's vitest.config.
|
||||||
|
//
|
||||||
|
// Resolution order:
|
||||||
|
// 1. VITEST_MAX_WORKERS — explicit per-run override, wins unconditionally.
|
||||||
|
// 2. FUSION_TEST_TOTAL_WORKERS — global budget across the workspace, divided
|
||||||
|
// by FUSION_TEST_CONCURRENCY (default 1). Lets `pnpm -r` runs cap total
|
||||||
|
// fan-out instead of multiplying per package.
|
||||||
|
// 3. defaultCap — small ceiling (2 by default) so a single package run on a
|
||||||
|
// high-core machine stays gentle.
|
||||||
|
// All paths clamp to (cpus - 1) so we never oversubscribe.
|
||||||
|
export function computeMaxWorkers(options: ComputeMaxWorkersOptions = {}): number {
|
||||||
|
const { defaultCap = 2 } = options;
|
||||||
|
|
||||||
|
const cpuCap = Math.max(1, cpus().length - 1);
|
||||||
|
|
||||||
|
const explicit = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "", 10);
|
||||||
|
if (Number.isFinite(explicit) && explicit > 0) {
|
||||||
|
const clamped = Math.min(Math.max(1, explicit), cpuCap);
|
||||||
|
process.env.VITEST_MAX_WORKERS = String(clamped);
|
||||||
|
return clamped;
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalBudget = Number.parseInt(process.env.FUSION_TEST_TOTAL_WORKERS ?? "", 10);
|
||||||
|
const concurrency = Math.max(
|
||||||
|
1,
|
||||||
|
Number.parseInt(process.env.FUSION_TEST_CONCURRENCY ?? "1", 10) || 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
let workers: number;
|
||||||
|
if (Number.isFinite(totalBudget) && totalBudget > 0) {
|
||||||
|
workers = Math.max(1, Math.floor(totalBudget / concurrency));
|
||||||
|
} else {
|
||||||
|
workers = defaultCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
workers = Math.min(workers, cpuCap);
|
||||||
|
process.env.VITEST_MAX_WORKERS = String(workers);
|
||||||
|
return workers;
|
||||||
|
}
|
||||||
@@ -1,14 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
import { cpus } from "node:os";
|
import { computeMaxWorkers } from "./src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Keep worker fan-out conservative by default. Over-subscribing threads can
|
const maxWorkers = computeMaxWorkers();
|
||||||
// starve Vitest's worker RPC channel and trigger flaky "onTaskUpdate" timeouts
|
|
||||||
// under heavy SQLite test load.
|
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
import { cpus } from "node:os";
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 so high-core dev machines don't spawn 27+ workers per
|
const maxWorkers = computeMaxWorkers({ defaultCap: 1 });
|
||||||
// package — that saturates the box when workspace packages test concurrently.
|
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
@@ -33,9 +28,11 @@ export default defineConfig({
|
|||||||
"./vitest.setup.ts",
|
"./vitest.setup.ts",
|
||||||
],
|
],
|
||||||
globalSetup: [resolve(__dirname, "../core/src/__test-utils__/vitest-teardown.ts")],
|
globalSetup: [resolve(__dirname, "../core/src/__test-utils__/vitest-teardown.ts")],
|
||||||
pool: "forks",
|
// Threads share a V8 heap so they're much lighter than forks for jsdom +
|
||||||
|
// React suites; forks duplicated the entire renderer per worker (~500MB).
|
||||||
|
pool: "threads",
|
||||||
maxWorkers,
|
maxWorkers,
|
||||||
poolOptions: { forks: { minForks: 1, maxForks: maxWorkers } },
|
poolOptions: { threads: { minThreads: 1, maxThreads: maxWorkers } },
|
||||||
fileParallelism: true,
|
fileParallelism: true,
|
||||||
isolate: true,
|
isolate: true,
|
||||||
// Dashboard route and integration-heavy suites can exceed the Vitest
|
// Dashboard route and integration-heavy suites can exceed the Vitest
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { cpus } from "node:os";
|
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 to avoid saturating high-core machines under workspace concurrency.
|
const maxWorkers = computeMaxWorkers();
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
import { cpus } from "node:os";
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 to avoid saturating high-core machines under workspace concurrency.
|
const maxWorkers = computeMaxWorkers();
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { cpus } from "node:os";
|
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 to avoid saturating high-core machines under workspace concurrency.
|
const maxWorkers = computeMaxWorkers();
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { cpus } from "node:os";
|
|
||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
// Cap fan-out to 4 to avoid saturating high-core machines under workspace concurrency.
|
const maxWorkers = computeMaxWorkers();
|
||||||
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
|
|
||||||
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { computeMaxWorkers } from "../../packages/core/src/__test-utils__/vitest-workers";
|
||||||
|
|
||||||
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? "2", 10);
|
const maxWorkers = computeMaxWorkers();
|
||||||
const maxWorkers = Math.max(1, Math.min(4, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : 2));
|
|
||||||
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
Reference in New Issue
Block a user