mirror of
https://github.com/morluto/rea
synced 2026-10-27 06:33:32 -04:00
fc4a9a0592
* fix(artifacts): preserve filesystem and DMG diagnostics * fix(artifacts): classify DMG verification failures * fix(artifacts): distinguish inaccessible disk images * fix(artifacts): classify damaged image checksums
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { execFileOutput } from "./ExecFileOutput.js";
|
|
|
|
describe("execFileOutput", () => {
|
|
it("captures output larger than Node's default execFile limit", async () => {
|
|
const marker = "tail-marker";
|
|
const result = await execFileOutput(process.execPath, [
|
|
"-e",
|
|
`process.stdout.write("x".repeat(2 * 1024 * 1024)); process.stdout.write(${JSON.stringify(marker)});`,
|
|
]);
|
|
|
|
expect(result.stdout).toHaveLength(2 * 1024 * 1024 + marker.length);
|
|
expect(result.stdout.endsWith(marker)).toBe(true);
|
|
});
|
|
|
|
it("enforces a caller supplied output bound", async () => {
|
|
await expect(
|
|
execFileOutput(
|
|
process.execPath,
|
|
["-e", 'process.stdout.write("x".repeat(1024))'],
|
|
{ maxBuffer: 64 },
|
|
),
|
|
).rejects.toMatchObject({ code: "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" });
|
|
});
|
|
|
|
it("retains both captured streams on a failed child process", async () => {
|
|
await expect(
|
|
execFileOutput(process.execPath, [
|
|
"-e",
|
|
'process.stdout.write("out"); process.stderr.write("err"); process.exitCode = 7;',
|
|
]),
|
|
).rejects.toMatchObject({ code: 7, stdout: "out", stderr: "err" });
|
|
});
|
|
});
|