test: micro-optimize hot unit test files

This commit is contained in:
Peter Steinberger
2026-03-02 05:30:25 +00:00
parent 1de3200973
commit 656121a12b
7 changed files with 146 additions and 104 deletions

View File

@@ -101,24 +101,24 @@ describe("runCommandWithTimeout", () => {
"let count = 0;",
'const ticker = setInterval(() => { process.stdout.write(".");',
"count += 1;",
"if (count === 10) {",
"if (count === 6) {",
"clearInterval(ticker);",
"process.exit(0);",
"}",
"}, 100);",
"}, 25);",
].join(" "),
],
{
timeoutMs: 10_000,
// Extra headroom for busy CI workers while still validating timer resets.
noOutputTimeoutMs: 2_500,
timeoutMs: 3_000,
// Keep a healthy margin above the emit interval while avoiding a 1s+ test delay.
noOutputTimeoutMs: 400,
},
);
expect(result.code ?? 0).toBe(0);
expect(result.termination).toBe("exit");
expect(result.noOutputTimedOut).toBe(false);
expect(result.stdout.length).toBeGreaterThanOrEqual(11);
expect(result.stdout.length).toBeGreaterThanOrEqual(7);
});
it("reports global timeout termination when overall timeout elapses", async () => {