Stage 2 of the int-suite speedup: pool=forks with fileParallelism and a default cap of 8 (VITEST_MAX_FORKS), each fork cloning the template into ptf_*_test_w<ID> via tests/vitest-worker-setup.ts; environment defaults to node with jsdom opt-in docblocks on the six DOM-consuming specs; a tiny reporter writes a failure marker so post-run cleanup keeps clones after red runs (KEEP_TEST_DBS=1 forces keeping); pg pools cap at TEST_PG_POOL_MAX=3 per boot in workers mode. Legacy serial mode stays reachable by setting TEST_DATABASE_URI. Notes from the gate G2 runs (Vitest 4.0.16): globalTeardown config was removed in Vitest 4 entirely - cleanup now returns from globalSetup. The pool scheduler only reuses worker processes when isolate:false, so this per-file-fork stage lands short of the wall-time target and is expected to be superseded by the gated isolate:false stage. Gate G2 warm serial equivalent stays green via TEST_DATABASE_URI bisect mode.
16 lines
752 B
TypeScript
16 lines
752 B
TypeScript
import { clearFailureMarker, writeFailureMarker } from "./vitest-marker";
|
|
|
|
/**
|
|
* Minimal custom reporter: records run outcome in the failure marker file so
|
|
* globalTeardown can keep worker database clones after a failed run (and drop
|
|
* them after a green one). See tests/vitest-marker.ts for why the reporter is
|
|
* the reliable channel. Vitest 4 calls onTestRunEnd(modules, errors, state)
|
|
* with state "passed" | "failed" | "interrupted".
|
|
*/
|
|
export default class FailureMarkerReporter {
|
|
onTestRunEnd(_modules: unknown[], errors: unknown[], state?: string): void {
|
|
const passed = (state ?? "passed") === "passed" && (!errors || errors.length === 0);
|
|
if (passed) clearFailureMarker();
|
|
else writeFailureMarker(state ?? "failed");
|
|
}
|
|
}
|