import { configDefaults, defineConfig } from 'vitest/config'; export default defineConfig({ test: { // The default 5s timeouts are too tight for this suite's DB-heavy tests: // ~16 files replay the full migration chain (runMigrations) against a fresh // sqlite DB, costing ~3-4s each in isolation. Under the full concurrent // suite on a contended CI runner (the act_runner shares its host with the // production orchestrator + the OSS runner) they overshoot 5s and flake — // e.g. migrate.gateway-2b.test.ts timed out at 6.5s in the test body. // // The heavy work lives in BOTH test bodies (gateway-2b) and beforeEach // hooks (repository.spaces-resource-isolation, repository-local-auth, // migrate.space-id which runs runMigrations twice, ...), so we raise // testTimeout AND hookTimeout — a body-only bump would leave the hook-based // files flaking on the 10s hookTimeout default. A global bump (vs per-file // timeouts on ~16 files × their hooks) is the maintainable choice for a // flake class that spans bodies, hooks, and future DB tests; 20s still // bounds a genuinely hung test (worst case ~15s slower feedback on a ~4min // suite). Individual slower tests (browser/Playwright) still set their own. testTimeout: 20_000, hookTimeout: 20_000, exclude: [ ...configDefaults.exclude, '.claude/**', '.superpowers/**', '.worktrees/**', // Runtime workspace output can contain user-generated Playwright specs. // They must only run through the workspace's intended test runner. 'data/worktrees/**', // Playwright E2E specs — run via `npm run test:e2e`, not vitest. They // import @playwright/test and fail collection under vitest. 'ui/e2e/**', 'ui/e2e-auth/**', ], }, });