test: harden flaky timeout and resolver specs
This commit is contained in:
@@ -101,25 +101,24 @@ describe("runCommandWithTimeout", () => {
|
||||
"let count = 0;",
|
||||
'const ticker = setInterval(() => { process.stdout.write(".");',
|
||||
"count += 1;",
|
||||
"if (count === 6) {",
|
||||
"if (count === 10) {",
|
||||
"clearInterval(ticker);",
|
||||
"process.exit(0);",
|
||||
"}",
|
||||
"}, 200);",
|
||||
"}, 100);",
|
||||
].join(" "),
|
||||
],
|
||||
{
|
||||
timeoutMs: 7_000,
|
||||
// Keep a generous idle budget; CI event-loop stalls can exceed 450ms.
|
||||
noOutputTimeoutMs: 900,
|
||||
timeoutMs: 10_000,
|
||||
// Extra headroom for busy CI workers while still validating timer resets.
|
||||
noOutputTimeoutMs: 2_500,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.signal).toBeNull();
|
||||
expect(result.code ?? 0).toBe(0);
|
||||
expect(result.termination).toBe("exit");
|
||||
expect(result.noOutputTimedOut).toBe(false);
|
||||
expect(result.stdout.length).toBeGreaterThanOrEqual(7);
|
||||
expect(result.stdout.length).toBeGreaterThanOrEqual(11);
|
||||
});
|
||||
|
||||
it("reports global timeout termination when overall timeout elapses", async () => {
|
||||
|
||||
@@ -127,7 +127,7 @@ describe("secrets audit", () => {
|
||||
await fs.writeFile(
|
||||
execScriptPath,
|
||||
[
|
||||
"#!/usr/bin/env node",
|
||||
`#!${process.execPath}`,
|
||||
"import fs from 'node:fs';",
|
||||
"const req = JSON.parse(fs.readFileSync(0, 'utf8'));",
|
||||
`fs.appendFileSync(${JSON.stringify(execLogPath)}, 'x\\n');`,
|
||||
@@ -147,7 +147,8 @@ describe("secrets audit", () => {
|
||||
source: "exec",
|
||||
command: execScriptPath,
|
||||
jsonOnly: true,
|
||||
passEnv: ["PATH"],
|
||||
timeoutMs: 20_000,
|
||||
noOutputTimeoutMs: 10_000,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user