Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions test/expectations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ test/js/node/test/parallel/test-stream-wrap-encoding.js [ FAIL ] # needs interna
# test-http-max-http-headers.js is vendored.
test/js/node/test/parallel/test-set-http-max-http-headers.js [ FAIL ] # spawns test-http-max-http-headers.js which is not vendored

# Tests that are flaky
test/js/bun/spawn/spawn-maxbuf.test.ts [ FLAKY ]

# Tests failed due to ASAN: attempting free on address which was not malloc()-ed
[ ASAN ] test/integration/next-pages/test/dev-server-ssr-100.test.ts [ CRASH ]
[ ASAN ] test/integration/next-pages/test/next-build.test.ts [ CRASH ]
Expand Down
14 changes: 10 additions & 4 deletions test/js/bun/spawn/spawn-maxbuf.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bunEnv, bunExe } from "harness";
import { bunEnv, bunExe, isDebug } from "harness";

const { isWindows } = require("../../node/test/common");

Expand All @@ -13,7 +13,13 @@ async function toUtf8(out: ReadableStream<Uint8Array>): Promise<string> {
}

describe("yes is killed", () => {
// TODO
// The wall-clock window below includes the child's startup (bunExe() has to
// boot before `yes` writes its first byte). On a debug+ASAN build that startup
// alone is ~150-250ms, so the release 100ms budget is spent before maxBuffer
// has anything to measure. Byte-level promptness is asserted by the "caps the
// buffer" tests below; this is the coarse "didn't wait a full tick" sanity check.
const killWindow = isDebug ? 1000 : 100;

test("Bun.spawn", async () => {
const timeStart = Date.now();
const proc = Bun.spawn([bunExe(), "exec", "yes"], {
Expand All @@ -25,7 +31,7 @@ describe("yes is killed", () => {
expect(proc.exitCode).toBe(null);
expect(proc.signalCode).toBe(isWindows ? "SIGKILL" : "SIGHUP");
const timeEnd = Date.now();
expect(timeEnd - timeStart).toBeLessThan(100); // make sure it's not waiting a full tick
expect(timeEnd - timeStart).toBeLessThan(killWindow);
const result = await toUtf8(proc.stdout);
expect(result).toStartWith("y\n".repeat(128));
const stderr = await toUtf8(proc.stderr);
Expand All @@ -43,7 +49,7 @@ describe("yes is killed", () => {
expect(proc.exitCode).toBe(null);
expect(proc.signalCode).toBe(isWindows ? "SIGKILL" : "SIGHUP");
const timeEnd = Date.now();
expect(timeEnd - timeStart).toBeLessThan(100); // make sure it's not waiting a full tick
expect(timeEnd - timeStart).toBeLessThan(killWindow);
const result = proc.stdout.toString("utf-8");
expect(result).toStartWith("y\n".repeat(128));
const stderr = proc.stderr.toString("utf-8");
Expand Down
Loading