test(ci): fix windows update and task cleanup cases

This commit is contained in:
Peter Steinberger
2026-04-03 22:22:42 +01:00
parent 9f132fc1b0
commit be1d31fa8a
2 changed files with 16 additions and 4 deletions

View File

@@ -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),