

























@@ -216,12 +216,12 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
216216describe("findGatewayPidsOnPortSync", () => {
217217it("returns [] when lsof exits with non-zero status", () => {
218218mockSpawnSync.mockReturnValue({ error: null, status: 1, stdout: "", stderr: "" });
219-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
219+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
220220});
221221222222it("logs warning when initial lsof scan exits with status > 1", () => {
223223mockSpawnSync.mockReturnValue({ error: null, status: 2, stdout: "", stderr: "lsof error" });
224-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
224+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
225225expect(mockRestartWarn).toHaveBeenCalledWith(
226226expect.stringContaining("lsof exited with status 2"),
227227);
@@ -234,7 +234,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
234234stdout: "",
235235stderr: "",
236236});
237-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
237+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
238238expect(mockRestartWarn).toHaveBeenCalledWith(
239239expect.stringContaining("lsof failed during initial stale-pid scan"),
240240);
@@ -427,7 +427,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
427427stdout: lsofOutput([{ pid: otherPid, cmd: "nginx" }]),
428428stderr: "",
429429});
430-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
430+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
431431});
432432433433it("forwards the spawnTimeoutMs argument to spawnSync", () => {
@@ -456,7 +456,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
456456Object.defineProperty(process, "platform", { value: "win32", configurable: true });
457457try {
458458mockReadWindowsListeningPids.mockReturnValue([]);
459-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
459+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
460460expect(mockReadWindowsListeningPids).toHaveBeenCalledWith(18789, undefined);
461461// lsof must NOT be invoked — Windows uses PowerShell/netstat
462462expect(mockSpawnSync).not.toHaveBeenCalled();
@@ -519,7 +519,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
519519describe("parsePidsFromLsofOutput (via findGatewayPidsOnPortSync stdout path)", () => {
520520it("returns [] for empty lsof stdout (status 0, nothing listening)", () => {
521521mockSpawnSync.mockReturnValue({ error: null, status: 0, stdout: "", stderr: "" });
522-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
522+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
523523});
524524525525it("parses multiple openclaw pids from a single lsof output block", () => {
@@ -549,7 +549,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
549549stdout: lsofOutput([{ pid: otherPid, cmd: "caddy" }]),
550550stderr: "",
551551});
552-expect(findGatewayPidsOnPortSync(18789)).toEqual([]);
552+expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]);
553553});
554554});
555555@@ -684,7 +684,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
684684it("returns [] and does not call process.kill when port has no listeners", () => {
685685mockSpawnSync.mockReturnValue({ error: null, status: 0, stdout: "", stderr: "" });
686686const killSpy = vi.spyOn(process, "kill").mockReturnValue(true);
687-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
687+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
688688expect(killSpy).not.toHaveBeenCalled();
689689});
690690@@ -889,7 +889,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
889889mockResolveGatewayPort.mockImplementationOnce(() => {
890890throw new Error("config read error");
891891});
892-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
892+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
893893});
894894895895it("returns gracefully when lsof is unavailable from the start", () => {
@@ -900,7 +900,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
900900stderr: "",
901901});
902902const killSpy = vi.spyOn(process, "kill").mockReturnValue(true);
903-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
903+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
904904expect(killSpy).not.toHaveBeenCalled();
905905});
906906@@ -970,7 +970,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
970970});
971971const killSpy = vi.spyOn(process, "kill").mockReturnValue(true);
972972973-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
973+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
974974expect(mockReadWindowsListeningPidsResult).toHaveBeenCalledWith(18789, 400);
975975expect(mockRestartWarn).toHaveBeenCalledWith(
976976expect.stringContaining("port 18789 still in use after 2000ms"),
@@ -1000,7 +1000,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
10001000mockReadWindowsProcessArgsResult.mockReturnValue({ ok: false, permanent: false });
10011001const killSpy = vi.spyOn(process, "kill").mockReturnValue(true);
100210021003-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
1003+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
10041004expect(mockReadWindowsProcessArgsResult).toHaveBeenCalledWith(stalePid, undefined);
10051005expect(mockRestartWarn).toHaveBeenCalledWith(
10061006expect.stringContaining("port 18789 still in use after 2000ms"),
@@ -1048,7 +1048,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
10481048return true;
10491049});
105010501051-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
1051+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
10521052expect(mockSpawnSync).toHaveBeenCalledWith(
10531053"C:\\Windows\\System32\\taskkill.exe",
10541054["/T", "/PID", String(stalePid)],
@@ -1103,7 +1103,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => {
11031103fakeNow += ms;
11041104});
110511051106-expect(cleanStaleGatewayProcessesSync()).toEqual([]);
1106+expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]);
11071107expect(mockSpawnSync).toHaveBeenNthCalledWith(
110811081,
11091109"C:\\Windows\\System32\\taskkill.exe",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。