From 1173c0a9dc1b352a60943a491462294db8f353ae Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 26 Oct 2026 03:20:13 +0800 Subject: [PATCH] test(setup): align launch fixtures with runtime and host requirements --- tests/acceptance/setup/launcherAliasesCli.test.ts | 14 +++++++++++--- .../filesystem/clientConfigurationBom.test.ts | 2 +- .../filesystem/doctorSystemHostFilesystem.test.ts | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/setup/launcherAliasesCli.test.ts b/tests/acceptance/setup/launcherAliasesCli.test.ts index 0d1b9e75af..90d679f095 100644 --- a/tests/acceptance/setup/launcherAliasesCli.test.ts +++ b/tests/acceptance/setup/launcherAliasesCli.test.ts @@ -10,13 +10,21 @@ import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js"; import { cliTest } from "../../support/cli/cliFixture.js"; cliTest.skipIf(process.platform === "win32")( - "migrates an owned shebang registration and starts its generated MCP command without PATH tools", + "migrates an owned shebang registration and starts its generated MCP command without a runtime on PATH", async ({ cli }) => { const home = await createTestTempDirectory("rea-registration-interpreter-"); const profile = join(home, ".qwen"); const config = join(profile, "settings.json"); const entrypoint = resolve("scripts/rea.mjs"); - const retainedEnvironment = { PATH: "", CALLER_SETTING: "keep exactly" }; + const restrictedPath = join(home, "path-without-runtime"); + await mkdir(restrictedPath); + // Linux process ownership requires procps; no JavaScript runtime is exposed. + if (process.platform === "linux") + await symlink("/bin/ps", join(restrictedPath, "ps")); + const retainedEnvironment = { + PATH: restrictedPath, + CALLER_SETTING: "keep exactly", + }; const unrelated = { command: "other-server", args: ["keep"] }; const original = JSON.stringify({ mcpServers: { @@ -34,7 +42,7 @@ cliTest.skipIf(process.platform === "win32")( HOME: home, USERPROFILE: home, QWEN_HOME: profile, - PATH: "", + PATH: restrictedPath, HOPPER_LAUNCHER_PATH: join(home, "missing-hopper"), GHIDRA_INSTALL_DIR: join(home, "missing-ghidra"), JAVA_HOME: join(home, "missing-java"), diff --git a/tests/boundary/filesystem/clientConfigurationBom.test.ts b/tests/boundary/filesystem/clientConfigurationBom.test.ts index c10c76741a..554577e60f 100644 --- a/tests/boundary/filesystem/clientConfigurationBom.test.ts +++ b/tests/boundary/filesystem/clientConfigurationBom.test.ts @@ -43,7 +43,7 @@ describe.each(["vscode", "copilot_cli", "opencode", "commandcode"])( await mkdir(dirname(client.configPath), { recursive: true }); await writeFile(client.configPath, original); const currentCommandPath = join(home, "rea"); - const command = [currentCommandPath, "mcp"]; + const command = [process.execPath, currentCommandPath, "mcp"]; expect(await inspectClientConfiguration(client, {}, command)).toEqual({ status: "update", backupPath: `${client.configPath}.rea.backup`, diff --git a/tests/boundary/filesystem/doctorSystemHostFilesystem.test.ts b/tests/boundary/filesystem/doctorSystemHostFilesystem.test.ts index 0abf149071..cf1396f0c8 100644 --- a/tests/boundary/filesystem/doctorSystemHostFilesystem.test.ts +++ b/tests/boundary/filesystem/doctorSystemHostFilesystem.test.ts @@ -23,7 +23,7 @@ it("threads the selected host and environment into system diagnostics", async () environment, execFileOutput: async (command, arguments_, options) => { calls.push({ command, arguments: arguments_, environment: options?.env }); - if (command === "sw_vers") + if (command === "/usr/bin/sw_vers") return { stdout: "15.0\n", stderr: "", @@ -52,12 +52,12 @@ it("threads the selected host and environment into system diagnostics", async () expect(host.platform).toBe("linux"); expect(host.architecture).toBe("x64"); await host.installationPaths?.(); - await host.macosVersion(); + expect(await host.macosVersion()).toBe("15.0"); await host.executable(process.execPath); expect(calls.map(({ command }) => command)).toEqual([ "which", - "sw_vers", + "/usr/bin/sw_vers", "ldd", ]); expect(