mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
test(process): check malformed capture choices concurrently
The malformed process-choice acceptance test spawned 26 CLI processes one after another. On CI it took 45-59 s against its 60 s deadline and timed out on unrelated PRs. Run the independent cases concurrently, each with its own scenario file; every assertion is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,21 +161,26 @@ captureTest(
|
||||
}),
|
||||
),
|
||||
];
|
||||
for (const options of invalid) {
|
||||
const request = { ...scenario, ...options };
|
||||
expect(
|
||||
(await call("capture_process_scenario", request)).isError,
|
||||
JSON.stringify(options),
|
||||
).toBe(true);
|
||||
const path = join(root, "scenario.json");
|
||||
await writeFile(path, JSON.stringify(request));
|
||||
await expect(
|
||||
execute(process.execPath, [cli, "capture-process", path, "--json"]),
|
||||
).rejects.toMatchObject({
|
||||
code: 1,
|
||||
stdout: expect.stringContaining("invalid_request"),
|
||||
});
|
||||
}
|
||||
// Each CLI case is an independent process; running them concurrently keeps
|
||||
// the suite well inside its deadline on slower CI runners.
|
||||
await Promise.all(
|
||||
invalid.map(async (options, index) => {
|
||||
const request = { ...scenario, ...options };
|
||||
expect(
|
||||
(await call("capture_process_scenario", request)).isError,
|
||||
JSON.stringify(options),
|
||||
).toBe(true);
|
||||
const path = join(root, `scenario-${String(index)}.json`);
|
||||
await writeFile(path, JSON.stringify(request));
|
||||
await expect(
|
||||
execute(process.execPath, [cli, "capture-process", path, "--json"]),
|
||||
JSON.stringify(options),
|
||||
).rejects.toMatchObject({
|
||||
code: 1,
|
||||
stdout: expect.stringContaining("invalid_request"),
|
||||
});
|
||||
}),
|
||||
);
|
||||
await expect(access(marker)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
const missing = join(root, "missing-executable");
|
||||
const failed = await call("capture_process_scenario", {
|
||||
|
||||
Reference in New Issue
Block a user