Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758/** * The suite's diagnostics gate, with the one budget no test runner can keep. * * Every test here captures an artifact and then calls `expectNoDiagnostics`, * which is the correctness gate — no write-during-read, no effect relaying its * own source, no unstable memo, no silently-held input. Those are properties of * the code and they stay gating. * * One of the codes in that gate is not a property of the code. `HOT_SCOPE_TIME` * warns when a scope spends more than `hotTime.budgetMs` (8ms, in a rolling * 1000ms window) *inside the compute*, and it is the only budget in the set that * is an absolute duration: the rest count re-runs, fan-out, deps, writes. So it * measures the machine the tests happen to run on. Vitest puts 39 files on the * cores at once, each in its own jsdom, and a virtual-list `<For>` that costs 3ms * alone costs 9-10ms when thirty other workers want the same core — around an 8ms * budget, which is a browser-main-thread number, decided by nothing about this * app. Three runs in a row: 8.3ms, 9.1ms, 8.7ms, on a rotating cast of tests that * had nothing in common but mounting the whole app, and the same warnings on a * tree with none of this branch's changes in it. * * Tolerating that code buys nothing in sloppiness, because nothing that matters * rides on it: a scope that is genuinely hot will re-run enough times for the * count-based budgets — `HOT_SCOPE_RERUNS`, `HOT_SCOPE_FANOUT`, `WIDE_SCOPE_DEPS`, * and the rerun/waste assertions in `@solidjs/diagnostics` — to say so without * asking how fast the CPU was that day. If one of those starts making the same * complaint about a machine rather than about the code, it belongs in this list * with its own sentence here; what it must not become is a skipped test. * * Two codes arrived with the Solid 2 RC line (`@solidjs/diagnostics` rc.14) and * neither is in this list, because neither is a property of the runner. * `WASTED_RECOMPUTE` is a scope that re-ran 5+ times in a second, every run * producing an unchanged value at ≥2 ms of compute — which is a machine-independent * statement about wasted work, and it was true: the transport's waveform rebuilt a * thousand-bar path on every track change and every look-knob press because it read * the store directly instead of reading an equality-gated memo (`components/WaveformRow.tsx`). * `FALLBACK_FLASH` is a `Loading` fallback that showed for under 150 ms, and it was * true too: the home route was code-split, so first paint fetched the only page there * ever is and flickered a placeholder in front of it (`codeSplitting: false` in * vite.config.ts fixed both the flicker and a second round trip, for no bytes). * A future RC adding a third code is welcome to fail here: read what it says before * it joins `HOT_SCOPE_TIME`, and note that the two above were not runner artifacts. */import { captureArtifact as capture, expectNoDiagnostics as strict, type DiagnosticCode, type DiagnosticsArtifact,} from "@solidjs/diagnostics";
export const captureArtifact = capture;
/** The budgets whose threshold is a number of milliseconds. */const RUNNER_LOAD_BUDGETS: DiagnosticCode[] = ["HOT_SCOPE_TIME"];
export function expectNoDiagnostics(artifact: DiagnosticsArtifact): void { strict(artifact, { allow: RUNNER_LOAD_BUDGETS });}