Three CI-load flakes from the same class — a fixed per-test timeout billed
for one-time module-transform/env-init cost:
- apps/desktop messaging/index.test.tsx: `await import('./index')` ran inside
renderMessaging(), so the FIRST test paid the whole MessagingView transform.
On loaded runners that alone blew the 15s testTimeout and cascade-failed all
subsequent tests in the file (unmounted DOM). Red on main runs 34599517793,
34600757569, 34601269252 (green file takes 15.7s on a green main run —
already over the first test's budget when billed there). Import moved to
module scope, where vitest bills it to collection.
- apps/desktop skills/index.test.tsx: same pattern, 9 call sites; the file ran
18.6s on a green main run. Deduplicated to one module-scope import (the
existing 60s describe-timeout stays for the legitimately slow tests).
- web SessionsPage.test.tsx: the web vitest project still ran on vitest's 5s
default while its per-row routing test legitimately takes 3.6-4.6s on GREEN
runs; run 34600757569 tipped it to 5079ms. Gave web/vitest.config.ts the
same 15s testTimeout the desktop project already carries, with the same
rationale comment.
Validation: both desktop files 5x consecutive green + green pinned to 1 CPU
core (worst-case contention); SessionsPage 3x green; full desktop ui project
(801 files / 7622 tests) green; tsc + eslint clean on touched files.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { defineConfig } from "vitest/config";
|
|
import babel from "@rolldown/plugin-babel";
|
|
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
|
|
/** Same component/hook-scoped compiler preset as vite.config.ts. */
|
|
function compilerPreset() {
|
|
const preset = reactCompilerPreset();
|
|
preset.rolldown.filter.code = /\/>|<\/|from\s*['"][^'"]*react/;
|
|
return preset;
|
|
}
|
|
import path from "path";
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), babel({ presets: [compilerPreset()] })],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
test: {
|
|
environment: "node",
|
|
include: ["src/**/*.test.{ts,tsx}"],
|
|
// The first test in a file pays env init + full module transform, and page
|
|
// suites (SessionsPage) legitimately run 3.5-4.5s on green CI runners —
|
|
// right against vitest's 5s default, so a loaded runner tips them into a
|
|
// timeout (main run 34600757569: 5079ms). Same headroom rationale as
|
|
// apps/desktop/vitest.config.ts; genuinely hung tests still fail.
|
|
testTimeout: 15_000,
|
|
},
|
|
});
|