aboutsummaryrefslogtreecommitdiff
path: root/test/js
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-05-12 08:05:46 -0300
committerGravatar GitHub <noreply@github.com> 2023-05-12 08:05:46 -0300
commitf8c840aec70061d5cc7d2ed211a176004d3fa2d2 (patch)
tree7729a91f68f3d6e75941ace977f11a529b6946ed /test/js
parent273ccbc241b27534751a280175cd01e16b054566 (diff)
downloadbun-f8c840aec70061d5cc7d2ed211a176004d3fa2d2.tar.gz
bun-f8c840aec70061d5cc7d2ed211a176004d3fa2d2.tar.zst
bun-f8c840aec70061d5cc7d2ed211a176004d3fa2d2.zip
fix large stdout output (#2850)
* fix large stdout output * remove skip from #2674 for testing * add big stdout test using spawnSync * add bunEnv on big stdout test
Diffstat (limited to 'test/js')
-rw-r--r--test/js/bun/io/big-stdout.js2
-rw-r--r--test/js/bun/io/bun-write.test.js19
2 files changed, 20 insertions, 1 deletions
diff --git a/test/js/bun/io/big-stdout.js b/test/js/bun/io/big-stdout.js
new file mode 100644
index 000000000..4719580e4
--- /dev/null
+++ b/test/js/bun/io/big-stdout.js
@@ -0,0 +1,2 @@
+const str = "a".repeat(300000);
+await Bun.write(Bun.stdout, str);
diff --git a/test/js/bun/io/bun-write.test.js b/test/js/bun/io/bun-write.test.js
index ab8063f16..120ba396d 100644
--- a/test/js/bun/io/bun-write.test.js
+++ b/test/js/bun/io/bun-write.test.js
@@ -1,7 +1,7 @@
import fs from "fs";
import { it, expect, describe } from "bun:test";
import path from "path";
-import { gcTick, withoutAggressiveGC } from "harness";
+import { gcTick, withoutAggressiveGC, bunExe, bunEnv } from "harness";
import { tmpdir } from "os";
it("Bun.write blob", async () => {
@@ -290,3 +290,20 @@ it.skip("Bun.write('output.html', HTMLRewriter.transform(Bun.file)))", async don
expect(await Bun.file(outpath).text()).toBe("<div><blink>it worked!</blink></div>");
done();
});
+
+it("#2674", async () => {
+ const file = path.join(import.meta.dir, "big-stdout.js");
+
+ const { stderr, stdout, exitCode } = Bun.spawnSync({
+ cmd: [bunExe(), "run", file],
+ env: bunEnv,
+ stderr: "pipe",
+ stdout: "pipe",
+ });
+ console.log(stderr?.toString());
+ const text = stdout?.toString();
+ expect(text?.length).toBe(300000);
+ const error = stderr?.toString();
+ expect(error?.length).toBeFalsy();
+ expect(exitCode).toBe(0);
+});