diff --git a/test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts b/test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts index 645236d68ae1..7504d752c55a 100644 --- a/test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts +++ b/test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts @@ -331,13 +331,13 @@ describe("qa-otel-smoke receiver bounds", () => { await Promise.race([ receiver.close(), - delay(1_000).then(() => { + delay(1_000, undefined, { ref: false }).then(() => { throw new Error("receiver close timed out"); }), ]); await Promise.race([ socketClosed, - delay(1_000).then(() => { + delay(1_000, undefined, { ref: false }).then(() => { throw new Error("socket close timed out"); }), ]); diff --git a/test/scripts/clawhub-fixture-server.test.ts b/test/scripts/clawhub-fixture-server.test.ts index 87280c50867d..eaa54176e96e 100644 --- a/test/scripts/clawhub-fixture-server.test.ts +++ b/test/scripts/clawhub-fixture-server.test.ts @@ -37,7 +37,7 @@ async function stopServer(child: FixtureServerChild) { child.once("exit", () => resolve()); }); child.kill("SIGTERM"); - await Promise.race([exited, delay(1_000)]); + await Promise.race([exited, delay(1_000, undefined, { ref: false })]); if (child.exitCode === null && child.signalCode === null) { child.kill("SIGKILL"); await exited; diff --git a/test/scripts/crabbox-wrapper.test.ts b/test/scripts/crabbox-wrapper.test.ts index 3423672c4863..941c34a164f7 100644 --- a/test/scripts/crabbox-wrapper.test.ts +++ b/test/scripts/crabbox-wrapper.test.ts @@ -599,7 +599,7 @@ async function waitForProcessExit( child.once("error", reject); child.once("exit", (status, signal) => resolve({ status, signal })); }), - delay(timeoutMs).then(() => { + delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error("timed out waiting for wrapper process exit"); }), ]); diff --git a/test/scripts/dev-tooling-safety.test.ts b/test/scripts/dev-tooling-safety.test.ts index 6fe27a2b8b87..ecc0aef494dc 100644 --- a/test/scripts/dev-tooling-safety.test.ts +++ b/test/scripts/dev-tooling-safety.test.ts @@ -103,7 +103,11 @@ async function waitForChildExit( child.once("exit", (status, signal) => resolve({ status, signal })); }), new Promise((_, reject) => { - setTimeout(() => reject(new Error("timed out waiting for child exit")), timeoutMs); + const timer = setTimeout( + () => reject(new Error("timed out waiting for child exit")), + timeoutMs, + ); + timer.unref(); }), ]); } diff --git a/test/scripts/e2e-mock-config-limits.test.ts b/test/scripts/e2e-mock-config-limits.test.ts index 1d1d91df2c51..26f9e0ead0fd 100644 --- a/test/scripts/e2e-mock-config-limits.test.ts +++ b/test/scripts/e2e-mock-config-limits.test.ts @@ -91,7 +91,7 @@ async function stopServer(child: ChildProcess) { child.kill("SIGTERM"); await Promise.race([ exited, - delay(1_000).then(() => { + delay(1_000, undefined, { ref: false }).then(() => { if (child.exitCode === null && child.signalCode === null) { child.kill("SIGKILL"); } diff --git a/test/scripts/openclaw-cross-os-release-checks.test.ts b/test/scripts/openclaw-cross-os-release-checks.test.ts index baca94d71d77..67f41d55a4d0 100644 --- a/test/scripts/openclaw-cross-os-release-checks.test.ts +++ b/test/scripts/openclaw-cross-os-release-checks.test.ts @@ -1068,13 +1068,13 @@ describe("scripts/openclaw-cross-os-release-checks", () => { socket.write(`GET ${url.pathname} HTTP/1.1\r\nHost: ${url.host}\r\n\r\n`); await Promise.race([ server.close(), - delay(1_000).then(() => { + delay(1_000, undefined, { ref: false }).then(() => { throw new Error("close timed out"); }), ]); await Promise.race([ socketClosePromise, - delay(1_000).then(() => { + delay(1_000, undefined, { ref: false }).then(() => { throw new Error("socket close timed out"); }), ]); diff --git a/test/scripts/prepare-extension-package-boundary-artifacts.test.ts b/test/scripts/prepare-extension-package-boundary-artifacts.test.ts index 758089bcb2b0..e6dd2c542039 100644 --- a/test/scripts/prepare-extension-package-boundary-artifacts.test.ts +++ b/test/scripts/prepare-extension-package-boundary-artifacts.test.ts @@ -93,7 +93,7 @@ async function waitForProcessExit( const exit = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { child.once("exit", (code, signal) => resolve({ code, signal })); }); - const timeout = delay(timeoutMs).then(() => { + const timeout = delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error(`Process ${child.pid ?? "unknown"} did not exit after ${timeoutMs}ms`); }); return Promise.race([exit, timeout]); diff --git a/test/scripts/run-vitest.test.ts b/test/scripts/run-vitest.test.ts index 3edbed17dc45..5ff662026eb0 100644 --- a/test/scripts/run-vitest.test.ts +++ b/test/scripts/run-vitest.test.ts @@ -1025,7 +1025,7 @@ async function waitForClose(child: ReturnType, timeoutMs = 5_000) new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { child.once("close", (code, signal) => resolve({ code, signal })); }), - delay(timeoutMs).then(() => { + delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error("timed out waiting for child close"); }), ]); diff --git a/test/scripts/telegram-user-crabbox-proof.test.ts b/test/scripts/telegram-user-crabbox-proof.test.ts index 2c8f832efe82..94b1434444a8 100644 --- a/test/scripts/telegram-user-crabbox-proof.test.ts +++ b/test/scripts/telegram-user-crabbox-proof.test.ts @@ -861,7 +861,7 @@ fs.writeFileSync(${JSON.stringify(recorderExitPath)}, "exited"); startDelayMs: 0, target: "linux", }), - delay(500).then(() => { + delay(500, undefined, { ref: false }).then(() => { throw new Error("recordProbeVideo hung after the recorder had already exited"); }), ]), diff --git a/test/scripts/test-extension.test.ts b/test/scripts/test-extension.test.ts index c3cfa4c104fb..f14b731a8381 100644 --- a/test/scripts/test-extension.test.ts +++ b/test/scripts/test-extension.test.ts @@ -1005,7 +1005,7 @@ async function waitForClose( new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { child.once("close", (code, signal) => resolve({ code, signal })); }), - delay(timeoutMs).then(() => { + delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error("timed out waiting for child close"); }), ]); diff --git a/test/scripts/test-live-shard.test.ts b/test/scripts/test-live-shard.test.ts index 9d949c1c5dcc..b5415ec01c55 100644 --- a/test/scripts/test-live-shard.test.ts +++ b/test/scripts/test-live-shard.test.ts @@ -580,7 +580,7 @@ async function waitForClose( new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { child.once("close", (code, signal) => resolve({ code, signal })); }), - delay(timeoutMs).then(() => { + delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error("timed out waiting for child close"); }), ]); diff --git a/test/scripts/test-live.test.ts b/test/scripts/test-live.test.ts index c73ca9756916..b9817c2bae61 100644 --- a/test/scripts/test-live.test.ts +++ b/test/scripts/test-live.test.ts @@ -258,7 +258,7 @@ async function waitForClose(child: ReturnType, timeoutMs = 5_000) new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { child.once("close", (code, signal) => resolve({ code, signal })); }), - delay(timeoutMs).then(() => { + delay(timeoutMs, undefined, { ref: false }).then(() => { throw new Error("timed out waiting for child close"); }), ]);