test: tests that assumed an idle machine wait for what they assert, or carry a budget for their work
Under a busy machine (the gate's lanes side by side, 12 busy cores) these went red at random: a press landed while the button was still busy, an answer was settled before it was asked for, a page grew past one wait's budget, a lazy chunk was transformed inside a 1 s wait, focus was taken a frame after the press. They now wait for the condition they depend on, preload the chunks they open, and the tests that do heavy work (whole-repo scans, the type-aware linter, module resets) carry an explicit budget naming that work. The whole suite four times under 12 busy-loop processes: red 4/4 before, 0/4 after.
This commit is contained in:
@@ -33,6 +33,11 @@ beforeAll(async () => {
|
||||
await import("./api");
|
||||
}, 60_000);
|
||||
|
||||
// Warm or not, each case still loads and evaluates the modules it imports afresh after its module
|
||||
// reset: tens of ms idle, but the same reload put sibling suites past 5 s when the full suite's
|
||||
// workers share a busy machine.
|
||||
const CASE_BUDGET = 30_000;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.resetModules();
|
||||
@@ -69,7 +74,7 @@ const raised = (level: "DEBUG" | "TRACE", hours = 24) => ({
|
||||
const codes = (batch: unknown[] | undefined) =>
|
||||
(batch ?? []).map((e) => (e as { event: string }).event);
|
||||
|
||||
describe("diagnostics level", () => {
|
||||
describe("diagnostics level", { timeout: CASE_BUDGET }, () => {
|
||||
it("the base level at boot sets INFO, streams nothing and logs nothing", async () => {
|
||||
const d = await fresh();
|
||||
d.applyDiagnostics(
|
||||
|
||||
Reference in New Issue
Block a user