fix(coding-agent): detect Windows pnpm global installs closes #3378

This commit is contained in:
Mario Zechner
2026-04-20 15:59:57 +02:00
parent aa1b587b10
commit d56e5aea0b
3 changed files with 35 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
import { afterEach, describe, expect, test } from "vitest";
import { detectInstallMethod, getUpdateInstruction } from "../src/config.js";
const execPathDescriptor = Object.getOwnPropertyDescriptor(process, "execPath");
function setExecPath(value: string): void {
Object.defineProperty(process, "execPath", {
value,
configurable: true,
});
}
afterEach(() => {
if (execPathDescriptor) {
Object.defineProperty(process, "execPath", execPathDescriptor);
}
});
describe("detectInstallMethod", () => {
test("detects pnpm from Windows .pnpm install paths", () => {
setExecPath(
"C:\\Users\\Admin\\Documents\\pnpm-repository\\global\\5\\.pnpm\\@mariozechner+pi-coding-agent@0.67.68\\node_modules\\@mariozechner\\pi-coding-agent\\dist\\cli.js",
);
expect(detectInstallMethod()).toBe("pnpm");
expect(getUpdateInstruction("@mariozechner/pi-coding-agent")).toBe(
"Run: pnpm install -g @mariozechner/pi-coding-agent",
);
});
});