diff --git a/src/daemon/inspect.test.ts b/src/daemon/inspect.test.ts index 94a6a63dd12..99c32c2cf4e 100644 --- a/src/daemon/inspect.test.ts +++ b/src/daemon/inspect.test.ts @@ -112,7 +112,7 @@ describe("findExtraGatewayServices (linux / scanSystemdDir) — real filesystem" await fs.mkdir(systemdDir, { recursive: true }); await fs.writeFile(path.join(systemdDir, "openclaw-test.service"), TEST_SERVICE_CONTENTS); const result = await findExtraGatewayServices({ HOME: tmpHome }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); } finally { await fs.rm(tmpHome, { recursive: true, force: true }); } @@ -130,7 +130,7 @@ describe("findExtraGatewayServices (linux / scanSystemdDir) — real filesystem" GATEWAY_SERVICE_CONTENTS, ); const result = await findExtraGatewayServices({ HOME: tmpHome }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); } finally { await fs.rm(tmpHome, { recursive: true, force: true }); } @@ -175,7 +175,7 @@ describe("findExtraGatewayServices (linux / scanSystemdDir) — real filesystem" COMPANION_SERVICE_CONTENTS, ); const result = await findExtraGatewayServices({ HOME: tmpHome }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); } finally { await fs.rm(tmpHome, { recursive: true, force: true }); } @@ -241,7 +241,7 @@ describe("findExtraGatewayServices (darwin / scanLaunchdDir) — real filesystem `, ); const result = await findExtraGatewayServices({ HOME: tmpHome }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); } finally { await fs.rm(tmpHome, { recursive: true, force: true }); } @@ -261,7 +261,7 @@ describe("findExtraGatewayServices (darwin / scanLaunchdDir) — real filesystem `, ); const result = await findExtraGatewayServices({ HOME: tmpHome }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); } finally { await fs.rm(tmpHome, { recursive: true, force: true }); } @@ -318,7 +318,7 @@ describe("findExtraGatewayServices (win32)", () => { it("skips schtasks queries unless deep mode is enabled", async () => { const result = await findExtraGatewayServices({}); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); expect(execSchtasksMock).not.toHaveBeenCalled(); }); @@ -330,7 +330,7 @@ describe("findExtraGatewayServices (win32)", () => { }); const result = await findExtraGatewayServices({}, { deep: true }); - expect(result).toEqual([]); + expect(result).toStrictEqual([]); }); it("collects only non-openclaw marker tasks from schtasks output", async () => { diff --git a/src/daemon/launchd.test.ts b/src/daemon/launchd.test.ts index a9543489766..8da56149202 100644 --- a/src/daemon/launchd.test.ts +++ b/src/daemon/launchd.test.ts @@ -962,7 +962,7 @@ describe("launchd install", () => { mode: "kickstart", waitForPid: process.pid, }); - expect(state.launchctlCalls).toEqual([]); + expect(state.launchctlCalls).toStrictEqual([]); }); it("surfaces detached handoff failures", async () => { diff --git a/src/infra/device-pairing.test.ts b/src/infra/device-pairing.test.ts index 6020ed5cbe2..07e13808aa7 100644 --- a/src/infra/device-pairing.test.ts +++ b/src/infra/device-pairing.test.ts @@ -307,7 +307,7 @@ describe("device pairing tokens", () => { const paired = await getPairedDevice("device-1", baseDir); expect(paired && listEffectivePairedDeviceRoles(paired)).toEqual(["node", "operator"]); - expect(paired?.tokens?.node?.scopes).toEqual([]); + expect(paired?.tokens?.node?.scopes).toStrictEqual([]); expect(paired?.tokens?.operator?.scopes).toEqual([ "operator.read", "operator.talk.secrets", @@ -655,8 +655,8 @@ describe("device pairing tokens", () => { expect(paired?.publicKey).toBe("public-key-node-1"); expect(paired?.role).toBe("node"); expect(paired?.roles).toEqual(["node"]); - expect(paired?.scopes).toEqual([]); - expect(paired?.approvedScopes).toEqual([]); + expect(paired?.scopes).toStrictEqual([]); + expect(paired?.approvedScopes).toStrictEqual([]); expect(paired?.tokens?.node).toMatchObject({ token: expect.any(String) }); expect(paired?.tokens?.operator).toBeUndefined(); }); @@ -903,8 +903,8 @@ describe("device pairing tokens", () => { await setupPairedNodeDevice(baseDir); const paired = await getPairedDevice("node-1", baseDir); - expect(paired?.scopes).toEqual([]); - expect(paired?.approvedScopes).toEqual([]); + expect(paired?.scopes).toStrictEqual([]); + expect(paired?.approvedScopes).toStrictEqual([]); const seededToken = requireToken(paired?.tokens?.node?.token); await expect( @@ -947,9 +947,9 @@ describe("device pairing tokens", () => { await approveDevicePairing(repair.request.requestId, { callerScopes: [] }, baseDir); const paired = await getPairedDevice("node-1", baseDir); - expect(paired?.scopes).toEqual([]); - expect(paired?.approvedScopes).toEqual([]); - expect(paired?.tokens?.node?.scopes).toEqual([]); + expect(paired?.scopes).toStrictEqual([]); + expect(paired?.approvedScopes).toStrictEqual([]); + expect(paired?.tokens?.node?.scopes).toStrictEqual([]); }); test("bootstrap pairing seeds node and operator device tokens explicitly", async () => { @@ -979,7 +979,7 @@ describe("device pairing tokens", () => { expect(paired?.approvedScopes).toEqual( expect.arrayContaining(PAIRING_SETUP_BOOTSTRAP_PROFILE.scopes), ); - expect(paired?.tokens?.node?.scopes).toEqual([]); + expect(paired?.tokens?.node?.scopes).toStrictEqual([]); expect(paired?.tokens?.operator?.scopes).toEqual( expect.arrayContaining(PAIRING_SETUP_BOOTSTRAP_PROFILE.scopes), ); @@ -1012,7 +1012,7 @@ describe("device pairing tokens", () => { const paired = await getPairedDevice("bootstrap-device-operator-scope", baseDir); expect(paired?.tokens?.operator?.scopes).toEqual(["operator.read", "operator.write"]); - expect(paired?.tokens?.node?.scopes).toEqual([]); + expect(paired?.tokens?.node?.scopes).toStrictEqual([]); }); test("bootstrap pairing bounds approved baseline to handoff scopes", async () => { @@ -1061,7 +1061,7 @@ describe("device pairing tokens", () => { "operator.talk.secrets", "operator.write", ]); - expect(paired?.tokens?.node?.scopes).toEqual([]); + expect(paired?.tokens?.node?.scopes).toStrictEqual([]); await expect( ensureDeviceToken({ deviceId: "bootstrap-device-bounded-baseline", @@ -1283,7 +1283,7 @@ describe("device pairing tokens", () => { "expected paired node device after revoke", ); expect(paired.roles).toContain("node"); - expect(listEffectivePairedDeviceRoles(paired)).toEqual([]); + expect(listEffectivePairedDeviceRoles(paired)).toStrictEqual([]); expect(hasEffectivePairedDeviceRole(paired, "node")).toBe(false); }); @@ -1297,7 +1297,7 @@ describe("device pairing tokens", () => { createdAtMs: Date.now(), approvedAtMs: Date.now(), }; - expect(listEffectivePairedDeviceRoles(device)).toEqual([]); + expect(listEffectivePairedDeviceRoles(device)).toStrictEqual([]); expect(hasEffectivePairedDeviceRole(device, "node")).toBe(false); expect(hasEffectivePairedDeviceRole(device, "operator")).toBe(false); }); diff --git a/src/infra/restart-stale-pids.test.ts b/src/infra/restart-stale-pids.test.ts index 5b938a1e0be..2c6100037c0 100644 --- a/src/infra/restart-stale-pids.test.ts +++ b/src/infra/restart-stale-pids.test.ts @@ -216,12 +216,12 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { describe("findGatewayPidsOnPortSync", () => { it("returns [] when lsof exits with non-zero status", () => { mockSpawnSync.mockReturnValue({ error: null, status: 1, stdout: "", stderr: "" }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); }); it("logs warning when initial lsof scan exits with status > 1", () => { mockSpawnSync.mockReturnValue({ error: null, status: 2, stdout: "", stderr: "lsof error" }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); expect(mockRestartWarn).toHaveBeenCalledWith( expect.stringContaining("lsof exited with status 2"), ); @@ -234,7 +234,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { stdout: "", stderr: "", }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); expect(mockRestartWarn).toHaveBeenCalledWith( expect.stringContaining("lsof failed during initial stale-pid scan"), ); @@ -427,7 +427,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { stdout: lsofOutput([{ pid: otherPid, cmd: "nginx" }]), stderr: "", }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); }); it("forwards the spawnTimeoutMs argument to spawnSync", () => { @@ -456,7 +456,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { Object.defineProperty(process, "platform", { value: "win32", configurable: true }); try { mockReadWindowsListeningPids.mockReturnValue([]); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); expect(mockReadWindowsListeningPids).toHaveBeenCalledWith(18789, undefined); // lsof must NOT be invoked — Windows uses PowerShell/netstat expect(mockSpawnSync).not.toHaveBeenCalled(); @@ -519,7 +519,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { describe("parsePidsFromLsofOutput (via findGatewayPidsOnPortSync stdout path)", () => { it("returns [] for empty lsof stdout (status 0, nothing listening)", () => { mockSpawnSync.mockReturnValue({ error: null, status: 0, stdout: "", stderr: "" }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); }); it("parses multiple openclaw pids from a single lsof output block", () => { @@ -549,7 +549,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { stdout: lsofOutput([{ pid: otherPid, cmd: "caddy" }]), stderr: "", }); - expect(findGatewayPidsOnPortSync(18789)).toEqual([]); + expect(findGatewayPidsOnPortSync(18789)).toStrictEqual([]); }); }); @@ -684,7 +684,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { it("returns [] and does not call process.kill when port has no listeners", () => { mockSpawnSync.mockReturnValue({ error: null, status: 0, stdout: "", stderr: "" }); const killSpy = vi.spyOn(process, "kill").mockReturnValue(true); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(killSpy).not.toHaveBeenCalled(); }); @@ -889,7 +889,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { mockResolveGatewayPort.mockImplementationOnce(() => { throw new Error("config read error"); }); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); }); it("returns gracefully when lsof is unavailable from the start", () => { @@ -900,7 +900,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { stderr: "", }); const killSpy = vi.spyOn(process, "kill").mockReturnValue(true); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(killSpy).not.toHaveBeenCalled(); }); @@ -970,7 +970,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { }); const killSpy = vi.spyOn(process, "kill").mockReturnValue(true); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(mockReadWindowsListeningPidsResult).toHaveBeenCalledWith(18789, 400); expect(mockRestartWarn).toHaveBeenCalledWith( expect.stringContaining("port 18789 still in use after 2000ms"), @@ -1000,7 +1000,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { mockReadWindowsProcessArgsResult.mockReturnValue({ ok: false, permanent: false }); const killSpy = vi.spyOn(process, "kill").mockReturnValue(true); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(mockReadWindowsProcessArgsResult).toHaveBeenCalledWith(stalePid, undefined); expect(mockRestartWarn).toHaveBeenCalledWith( expect.stringContaining("port 18789 still in use after 2000ms"), @@ -1048,7 +1048,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { return true; }); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(mockSpawnSync).toHaveBeenCalledWith( "C:\\Windows\\System32\\taskkill.exe", ["/T", "/PID", String(stalePid)], @@ -1103,7 +1103,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { fakeNow += ms; }); - expect(cleanStaleGatewayProcessesSync()).toEqual([]); + expect(cleanStaleGatewayProcessesSync()).toStrictEqual([]); expect(mockSpawnSync).toHaveBeenNthCalledWith( 1, "C:\\Windows\\System32\\taskkill.exe", diff --git a/src/security/skill-scanner.test.ts b/src/security/skill-scanner.test.ts index 193fd8e2c91..2d1487042fa 100644 --- a/src/security/skill-scanner.test.ts +++ b/src/security/skill-scanner.test.ts @@ -298,7 +298,7 @@ export function greet(name: string): string { } `; const findings = scanSource(source, "plugin.ts"); - expect(findings).toEqual([]); + expect(findings).toStrictEqual([]); }); it("returns empty array for normal http client code (just a fetch GET)", () => { @@ -308,7 +308,7 @@ const json = await response.json(); console.log(json); `; const findings = scanSource(source, "plugin.ts"); - expect(findings).toEqual([]); + expect(findings).toStrictEqual([]); }); it("does not treat fetch in names or comments as network send context", () => { diff --git a/src/tui/components/chat-log.test.ts b/src/tui/components/chat-log.test.ts index 64b64229b7e..bab5b1325a3 100644 --- a/src/tui/components/chat-log.test.ts +++ b/src/tui/components/chat-log.test.ts @@ -155,7 +155,9 @@ describe("ChatLog", () => { chatLog.addPendingUser("run-1", "continue", 5_000); - expect(chatLog.reconcilePendingUsers([{ text: "continue", timestamp: -56_000 }])).toEqual([]); + expect(chatLog.reconcilePendingUsers([{ text: "continue", timestamp: -56_000 }])).toStrictEqual( + [], + ); expect(chatLog.countPendingUsers()).toBe(1); }); });