Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion scripts/run-all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,21 @@ async function runProbe(
const logPath = join(workspace, `probe-${logCounter}.log`);
await writeFile(logPath, "");

// The parent process may have WORKBENCH_CHECK_CONCURRENCY set for the
// gate itself. Default-concurrency probes must not inherit it; tests that
// intend an override pass the var in extraEnv.
const env: NodeJS.ProcessEnv = {
...process.env,
PROBE_LOG: logPath,
...extraEnv,
};
if (!Object.hasOwn(extraEnv, "WORKBENCH_CHECK_CONCURRENCY")) {
delete env["WORKBENCH_CHECK_CONCURRENCY"];
}

const child = Bun.spawn(["bun", "run", RUNNER, script], {
cwd: workspace,
env: { ...process.env, PROBE_LOG: logPath, ...extraEnv },
env,
stdout: "pipe",
stderr: "pipe",
});
Expand Down Expand Up @@ -168,6 +180,22 @@ describe("run-all", () => {
}
});

test("default sequential run ignores ambient WORKBENCH_CHECK_CONCURRENCY", async () => {
const previous = process.env["WORKBENCH_CHECK_CONCURRENCY"];
process.env["WORKBENCH_CHECK_CONCURRENCY"] = "4";
try {
const result = await runProbe({}, SEQUENTIAL_SCRIPT);

expect(peakOverlap(result.log)).toBe(1);
} finally {
if (previous === undefined) {
delete process.env["WORKBENCH_CHECK_CONCURRENCY"];
} else {
process.env["WORKBENCH_CHECK_CONCURRENCY"] = previous;
}
}
});

test("honours an explicit concurrency for the test script", async () => {
const result = await runProbe(
{ WORKBENCH_CHECK_CONCURRENCY: "3" },
Expand Down
Loading