From be1d31fa8a853440b3c592118d5fd6471c78620c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 3 Apr 2026 22:22:42 +0100 Subject: [PATCH] test(ci): fix windows update and task cleanup cases --- src/cli/update-cli.test.ts | 16 ++++++++++++---- src/tasks/task-executor.test.ts | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/cli/update-cli.test.ts b/src/cli/update-cli.test.ts index ac298eeaeab..0f784b8438c 100644 --- a/src/cli/update-cli.test.ts +++ b/src/cli/update-cli.test.ts @@ -751,7 +751,6 @@ describe("update-cli", () => { const brewRoot = path.join(brewPrefix, "lib", "node_modules"); const pkgRoot = path.join(brewRoot, "openclaw"); const brewNpm = path.join(brewPrefix, "bin", "npm"); - const win32PrefixNpm = path.join(brewPrefix, "npm.cmd"); const pathNpmRoot = createCaseDir("nvm-root"); mockPackageInstallStatus(pkgRoot); pathExists.mockResolvedValue(false); @@ -809,15 +808,24 @@ describe("update-cli", () => { .mock.calls.find( ([argv]) => Array.isArray(argv) && - [path.normalize(brewNpm), path.normalize(win32PrefixNpm)].includes( - path.normalize(String(argv[0] ?? "")), - ) && argv[1] === "i" && argv[2] === "-g" && argv[3] === "openclaw@latest", ); expect(installCall).toBeDefined(); + const installCommand = String(installCall?.[0][0] ?? ""); + expect(installCommand).not.toBe("npm"); + expect(path.isAbsolute(installCommand)).toBe(true); + expect(path.normalize(installCommand)).toContain(path.normalize(brewPrefix)); + expect(path.normalize(installCommand)).toMatch( + new RegExp( + `${path + .normalize(path.join(brewPrefix, path.sep)) + .replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}.*npm(?:\\.cmd)?$`, + "i", + ), + ); expect(installCall?.[1]).toEqual( expect.objectContaining({ timeoutMs: expect.any(Number), diff --git a/src/tasks/task-executor.test.ts b/src/tasks/task-executor.test.ts index 1cf9adca97f..9f437684e94 100644 --- a/src/tasks/task-executor.test.ts +++ b/src/tasks/task-executor.test.ts @@ -317,6 +317,10 @@ describe("task-executor", () => { ownerKey: "agent:main:main", controllerId: "tests/managed-flow", goal: "Inspect PR batch", + requesterOrigin: { + channel: "telegram", + to: "telegram:123", + }, }); const child = createRunningTaskRun({ runtime: "acp",