test(scripts): use true package timer overflow inputs

This commit is contained in:
Vincent Koc
2026-06-22 05:29:31 +02:00
parent 05580342f7
commit e9be15ff19

View File

@@ -5,7 +5,6 @@ import { access, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promise
import { tmpdir } from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";
import { MAX_TIMER_TIMEOUT_MS } from "@openclaw/normalization-core/number-coercion";
import { afterEach, describe, expect, it, vi } from "vitest";
import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs";
import {
@@ -413,8 +412,8 @@ describe("resolve-openclaw-package-candidate", () => {
it("clamps oversized package runner command timers before scheduling", async () => {
await expect(
runCommandForTest(process.execPath, ["-e", "setTimeout(() => process.exit(0), 25);"], {
killAfterMs: MAX_TIMER_TIMEOUT_MS + 1,
timeoutMs: MAX_TIMER_TIMEOUT_MS + 1,
killAfterMs: Number.MAX_SAFE_INTEGER,
timeoutMs: Number.MAX_SAFE_INTEGER,
}),
).resolves.toBe("");
});
@@ -481,7 +480,7 @@ describe("resolve-openclaw-package-candidate", () => {
const timeoutAssertion = expect(
runCommandForTest(process.execPath, ["-e", childScript], {
killAfterMs: MAX_TIMER_TIMEOUT_MS + 1,
killAfterMs: Number.MAX_SAFE_INTEGER,
timeoutMs: 500,
}),
).rejects.toThrow(/timed out after 500ms/u);
@@ -1138,7 +1137,7 @@ describe("resolve-openclaw-package-candidate", () => {
),
lookupHost: lookupAddresses([{ address: "93.184.216.34", family: 4 }]),
maxBytes: 3,
timeoutMs: MAX_TIMER_TIMEOUT_MS + 1,
timeoutMs: Number.MAX_SAFE_INTEGER,
});
await expect(readFile(target)).resolves.toEqual(Buffer.from([1, 2, 3]));