test(setup): align launch fixtures with runtime and host requirements

This commit is contained in:
morluto committed 2026-10-26 03:20:13 +08:00
1 parent db4d3abcda
commit 1173c0a9dc
3 files changed
+15 -7

No files matched your search

@@ -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"),
@@ -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`,
@@ -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(