From 683d892eede2cd296b5012c6d27c04f094d78550 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 4 May 2026 23:13:58 +0100 Subject: [PATCH] test: make global install shell test portable --- src/infra/update-global.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/infra/update-global.test.ts b/src/infra/update-global.test.ts index 20c401162f9..e399aba43ac 100644 --- a/src/infra/update-global.test.ts +++ b/src/infra/update-global.test.ts @@ -1,3 +1,4 @@ +import fsSync from "node:fs"; import fs from "node:fs/promises"; import path from "node:path"; import { bundledDistPluginFile } from "openclaw/plugin-sdk/test-fixtures"; @@ -152,6 +153,9 @@ describe("update global helpers", () => { it("uses an absolute POSIX script shell for npm lifecycle scripts during global installs", async () => { const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("linux"); + const existsSyncSpy = vi + .spyOn(fsSync, "existsSync") + .mockImplementation((candidate) => candidate === "/bin/sh"); try { await expect( createGlobalInstallEnv({ @@ -163,6 +167,7 @@ describe("update global helpers", () => { NPM_CONFIG_SCRIPT_SHELL: "/bin/sh", }); } finally { + existsSyncSpy.mockRestore(); platformSpy.mockRestore(); } });