test: stabilize loaded full-suite checks

This commit is contained in:
Peter Steinberger
2026-04-12 11:52:43 -07:00
parent d35cc6ef86
commit e4841d767d
9 changed files with 61 additions and 34 deletions

View File

@@ -312,7 +312,7 @@ describe("check-extension-package-tsc-boundary", () => {
"process.exit(2);",
].join(" "),
],
5_000,
20_000,
),
).rejects.toMatchObject({
message: expect.stringContaining("[... 6 earlier lines omitted ...]"),
@@ -320,31 +320,33 @@ describe("check-extension-package-tsc-boundary", () => {
kind: "nonzero-exit",
elapsedMs: expect.any(Number),
});
});
}, 30_000);
it("aborts concurrent sibling steps after the first failure", async () => {
const startedAt = Date.now();
const slowStepTimeoutMs = 60_000;
const abortBudgetMs = 30_000;
await expect(
runNodeStepsWithConcurrency(
[
{
label: "fail-fast",
args: ["--eval", "setTimeout(() => process.exit(2), 10)"],
timeoutMs: 5_000,
args: ["--eval", "process.exit(2)"],
timeoutMs: slowStepTimeoutMs,
},
{
label: "slow-step",
args: ["--eval", "setTimeout(() => {}, 10_000)"],
timeoutMs: 5_000,
args: ["--eval", "setTimeout(() => {}, 60_000)"],
timeoutMs: slowStepTimeoutMs,
},
],
2,
),
).rejects.toThrow("fail-fast");
expect(Date.now() - startedAt).toBeLessThan(2_000);
});
expect(Date.now() - startedAt).toBeLessThan(abortBudgetMs);
}, 45_000);
it("passes successful step timing metadata to onSuccess handlers", async () => {
const elapsedTimes: number[] = [];
@@ -353,8 +355,8 @@ describe("check-extension-package-tsc-boundary", () => {
[
{
label: "demo-step",
args: ["--eval", "setTimeout(() => process.exit(0), 10)"],
timeoutMs: 5_000,
args: ["--eval", "process.exit(0)"],
timeoutMs: 20_000,
onSuccess(result: { elapsedMs: number }) {
elapsedTimes.push(result.elapsedMs);
},
@@ -365,5 +367,5 @@ describe("check-extension-package-tsc-boundary", () => {
expect(elapsedTimes).toHaveLength(1);
expect(elapsedTimes[0]).toBeGreaterThanOrEqual(0);
});
}, 30_000);
});

View File

@@ -36,24 +36,26 @@ describe("prepare-extension-package-boundary-artifacts", () => {
it("aborts sibling steps after the first failure", async () => {
const startedAt = Date.now();
const slowStepTimeoutMs = 60_000;
const abortBudgetMs = 30_000;
await expect(
runNodeStepsInParallel([
{
label: "fail-fast",
args: ["--eval", "setTimeout(() => process.exit(2), 10)"],
timeoutMs: 5_000,
args: ["--eval", "process.exit(2)"],
timeoutMs: slowStepTimeoutMs,
},
{
label: "slow-step",
args: ["--eval", "setTimeout(() => {}, 10_000)"],
timeoutMs: 5_000,
args: ["--eval", "setTimeout(() => {}, 60_000)"],
timeoutMs: slowStepTimeoutMs,
},
]),
).rejects.toThrow("fail-fast failed with exit code 2");
expect(Date.now() - startedAt).toBeLessThan(2_000);
});
expect(Date.now() - startedAt).toBeLessThan(abortBudgetMs);
}, 45_000);
it("treats artifacts as fresh only when outputs are newer than inputs", () => {
const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-boundary-prep-"));