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>
This commit is contained in:
Jarred Sumner
2025-07-14 00:47:53 -07:00
committed by GitHub
parent 9ac6690fb7
commit 2e02d9de28
81 changed files with 970 additions and 961 deletions

View File

@@ -1166,7 +1166,7 @@ export async function runBunInstall(
});
expect(stdout).toBeDefined();
expect(stderr).toBeDefined();
let err = stderrForInstall(await new Response(stderr).text());
let err = stderrForInstall(await stderr.text());
expect(err).not.toContain("panic:");
if (!options?.allowErrors) {
expect(err).not.toContain("error:");
@@ -1177,7 +1177,7 @@ export async function runBunInstall(
if ((options?.savesLockfile ?? true) && !production && !options?.frozenLockfile) {
expect(err).toContain("Saved lockfile");
}
let out = await new Response(stdout).text();
let out = await stdout.text();
expect(await exited).toBe(options?.expectedExitCode ?? 0);
return { out, err, exited };
}
@@ -1201,8 +1201,8 @@ export async function runBunUpdate(
env,
});
let err = await Bun.readableStreamToText(stderr);
let out = await Bun.readableStreamToText(stdout);
let err = await stderr.text();
let out = await stdout.text();
let exitCode = await exited;
if (exitCode !== 0) {
console.log("stdout:", out);
@@ -1223,13 +1223,13 @@ export async function pack(cwd: string, env: NodeJS.Dict<string>, ...args: strin
env,
});
const err = await Bun.readableStreamToText(stderr);
const err = await stderr.text();
expect(err).not.toContain("error:");
expect(err).not.toContain("warning:");
expect(err).not.toContain("failed");
expect(err).not.toContain("panic:");
const out = await Bun.readableStreamToText(stdout);
const out = await stdout.text();
const exitCode = await exited;
expect(exitCode).toBe(0);