Files
bun.sh/test/js/bun/spawn/spawn-empty-arrayBufferOrBlob.test.ts
Jarred Sumner 2e02d9de28 Use ReadableStream.prototype.* in tests instead of new Response(...).* (#20937)
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Alistair Smith <hi@alistair.sh>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-14 00:47:53 -07:00

26 lines
755 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, proc.stdout.text(), proc.stderr.text()]);
expect(exited).toBe(0);
expect(stdout).toBeEmpty();
expect(stderr).toBeEmpty();
});
}
});