diff --git a/package.json b/package.json index 9f253442f2..29c7f24cfd 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "fmt": "oxfmt \"apps/desktop/src/**/*.{ts,vue}\"", "pretest": "pnpm generate:connection-types", "test": "vitest run", + "test:watch": "vitest", "preview": "vite preview --config apps/desktop/vite.config.ts", "tauri": "tauri", "prepare": "husky" diff --git a/vitest.config.ts b/vitest.config.ts index 27aba5d20f..91bbb1089f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -13,9 +13,14 @@ export default defineConfig({ test: { include: ["packages/app-tests/*.test.ts", "apps/desktop/src/**/*.spec.ts", "docs/lib/*.test.ts"], globalSetup: "packages/test-globals.ts", - // Large store modules are dynamically imported in many specs. Limiting - // concurrency prevents those imports from starving timers and making - // otherwise deterministic deferred-promise tests exceed Vitest's timeout. - maxWorkers: 4, + // Many specs dynamically import the large store modules (connectionStore, + // queryStore) inside test bodies; when several workers pay that first + // import at once, CPU contention can stall a worker's event loop past the + // old 5s default and flake deferred-promise tests. A 10s timeout absorbs + // that without capping throughput, so workers can scale past 4. CI keeps + // 4 workers: its 4-vCPU runners already run vue-tsc/oxlint/oxfmt + // concurrently with vitest via `pnpm check`. + testTimeout: 10_000, + maxWorkers: process.env.CI ? 4 : 8, }, });