Files
bun.sh/test/js/bun/spawn/spawn-empty-arrayBufferOrBlob.test.ts
2024-09-03 21:32:52 -07:00

30 lines
816 B
TypeScript

import { describe, expect, test } from "bun:test";
import { bunEnv, bunExe } from "harness";
describe("spawn with empty", () => {
for (const [stdin, label] of [
[new ArrayBuffer(0), "ArrayBuffer"],
[new Uint8Array(0), "Uint8Array"],
[new Blob([]), "Blob"],
] as const) {
test(label + " for stdin", async () => {
const proc = Bun.spawn({
cmd: [bunExe(), "-e", "process.stdin.pipe(process.stdout)"],
stdin,
stdout: "pipe",
stderr: "pipe",
env: bunEnv,
});
const [exited, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
]);
expect(exited).toBe(0);
expect(stdout).toBeEmpty();
expect(stderr).toBeEmpty();
});
}
});