fix(test): remove explicit test timeout per test/CLAUDE.md guidelines

Bun's test runner has built-in timeouts, so explicit timeout params
are unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alistair Smith
2026-02-10 16:41:18 -08:00
parent 7f01e99c55
commit a54d19e533

View File

@@ -211,14 +211,12 @@ describe("Runtime inspector activation", () => {
expect(matches?.length ?? 0).toBe(2);
});
test.skipIf(skipASAN)(
"can activate inspector in multiple processes sequentially",
async () => {
// Note: Runtime inspector uses hardcoded port 6499, so we must test
// sequential activation (activate first, shut down, then activate second)
// rather than concurrent activation.
using dir = tempDir("debug-process-multi-test", {
"target.js": `
test.skipIf(skipASAN)("can activate inspector in multiple processes sequentially", async () => {
// Note: Runtime inspector uses hardcoded port 6499, so we must test
// sequential activation (activate first, shut down, then activate second)
// rather than concurrent activation.
using dir = tempDir("debug-process-multi-test", {
"target.js": `
const fs = require("fs");
const path = require("path");
const id = process.argv[2];
@@ -229,94 +227,92 @@ describe("Runtime inspector activation", () => {
// Keep process alive until parent kills it
setInterval(() => {}, 1000);
`,
});
const decoder = new TextDecoder();
// First process: activate inspector, verify, then shut down
{
await using target1 = spawn({
cmd: [bunExe(), "target.js", "1"],
cwd: String(dir),
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const decoder = new TextDecoder();
// First process: activate inspector, verify, then shut down
{
await using target1 = spawn({
cmd: [bunExe(), "target.js", "1"],
cwd: String(dir),
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const reader1 = target1.stdout.getReader();
let output1 = "";
while (!output1.includes("READY-1")) {
const { value, done } = await reader1.read();
if (done) break;
output1 += decoder.decode(value, { stream: true });
}
reader1.releaseLock();
const pid1 = parseInt(await Bun.file(join(String(dir), "pid-1")).text(), 10);
expect(pid1).toBeGreaterThan(0);
await using debug1 = spawn({
cmd: [bunExe(), "-e", `process._debugProcess(${pid1})`],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const debug1Stderr = await debug1.stderr.text();
expect(debug1Stderr).toBe("");
expect(await debug1.exited).toBe(0);
const result1 = await waitForDebuggerListening(target1.stderr);
expect(result1.stderr).toContain("Bun Inspector");
target1.kill();
await target1.exited;
const reader1 = target1.stdout.getReader();
let output1 = "";
while (!output1.includes("READY-1")) {
const { value, done } = await reader1.read();
if (done) break;
output1 += decoder.decode(value, { stream: true });
}
reader1.releaseLock();
// Second process: now that first is shut down, port 6499 is free
{
await using target2 = spawn({
cmd: [bunExe(), "target.js", "2"],
cwd: String(dir),
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const pid1 = parseInt(await Bun.file(join(String(dir), "pid-1")).text(), 10);
expect(pid1).toBeGreaterThan(0);
const reader2 = target2.stdout.getReader();
let output2 = "";
while (!output2.includes("READY-2")) {
const { value, done } = await reader2.read();
if (done) break;
output2 += decoder.decode(value, { stream: true });
}
reader2.releaseLock();
await using debug1 = spawn({
cmd: [bunExe(), "-e", `process._debugProcess(${pid1})`],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const pid2 = parseInt(await Bun.file(join(String(dir), "pid-2")).text(), 10);
expect(pid2).toBeGreaterThan(0);
const debug1Stderr = await debug1.stderr.text();
expect(debug1Stderr).toBe("");
expect(await debug1.exited).toBe(0);
await using debug2 = spawn({
cmd: [bunExe(), "-e", `process._debugProcess(${pid2})`],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const result1 = await waitForDebuggerListening(target1.stderr);
const debug2Stderr = await debug2.stderr.text();
expect(debug2Stderr).toBe("");
expect(await debug2.exited).toBe(0);
expect(result1.stderr).toContain("Bun Inspector");
const result2 = await waitForDebuggerListening(target2.stderr);
target1.kill();
await target1.exited;
}
expect(result2.stderr).toContain("Bun Inspector");
// Second process: now that first is shut down, port 6499 is free
{
await using target2 = spawn({
cmd: [bunExe(), "target.js", "2"],
cwd: String(dir),
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
target2.kill();
await target2.exited;
const reader2 = target2.stdout.getReader();
let output2 = "";
while (!output2.includes("READY-2")) {
const { value, done } = await reader2.read();
if (done) break;
output2 += decoder.decode(value, { stream: true });
}
},
30000,
);
reader2.releaseLock();
const pid2 = parseInt(await Bun.file(join(String(dir), "pid-2")).text(), 10);
expect(pid2).toBeGreaterThan(0);
await using debug2 = spawn({
cmd: [bunExe(), "-e", `process._debugProcess(${pid2})`],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const debug2Stderr = await debug2.stderr.text();
expect(debug2Stderr).toBe("");
expect(await debug2.exited).toBe(0);
const result2 = await waitForDebuggerListening(target2.stderr);
expect(result2.stderr).toContain("Bun Inspector");
target2.kill();
await target2.exited;
}
});
test("throws when called with no arguments", async () => {
await using proc = spawn({