perf(test): parallelize harder — unlock worker count, split build-output, bump workspace concurrency

- All 8 vitest configs now default maxWorkers to \`cpus().length - 1\`
  instead of the arbitrary \`Math.min(4, …)\` cap. Respects an explicit
  VITEST_MAX_WORKERS override for constrained environments (CI, laptops
  on battery). CLI keeps \`fileParallelism: false\` — audit found real
  shared state (process.chdir in agent-import, dist/ races in build-exe
  suites) that needs refactoring before we can flip it.
- packages/dashboard: move the mobile build-output smoke test (which
  invokes \`pnpm build:client\` via execSync, ~3s per run) into a
  dedicated \`test:build\` script so \`pnpm test\` isn't gated by it. A
  matching root script keeps CI wiring simple.
- Root: bump --workspace-concurrency from 2 → 4 so core/engine/cli/
  desktop can pipeline against dashboard's tail.
- Drop the now-redundant VITEST_MAX_WORKERS=4 prefix from the root
  scripts; the per-package configs pick up cpu count themselves.

Dashboard test suite: 182s → 38s (5x) on a 10-core machine. Full
workspace run: ~3m15 → 2m29. All tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 19:31:13 -07:00
parent dca56336fc
commit 3fabd9d9e5
10 changed files with 32 additions and 19 deletions

View File

@@ -22,9 +22,10 @@
"verify:workspace": "pnpm lint && pnpm test && pnpm build",
"build:exe": "pnpm build && pnpm --filter @runfusion/fusion build:exe",
"build:exe:all": "pnpm build && pnpm --filter @runfusion/fusion build:exe:all",
"test": "VITEST_MAX_WORKERS=4 pnpm -r --workspace-concurrency=2 test",
"test": "pnpm -r --workspace-concurrency=4 test",
"test:serial": "pnpm -r --workspace-concurrency=1 test",
"test:fast": "VITEST_MAX_WORKERS=4 pnpm -r --workspace-concurrency=2 test",
"test:fast": "pnpm -r --workspace-concurrency=4 test",
"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:check-isolation": "node scripts/check-test-isolation.mjs",
"test:coverage": "pnpm -r --workspace-concurrency=1 exec vitest run --silent=passed-only --reporter=dot --coverage",