refactor: centralize update targets and extension guardrails

This commit is contained in:
Peter Steinberger
2026-04-03 23:24:00 +09:00
parent 8f5f78bbe8
commit b40d4b63f6
15 changed files with 354 additions and 92 deletions

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { resolvePnpmRunner } from "../../scripts/pnpm-runner.mjs";
import { createPnpmRunnerSpawnSpec, resolvePnpmRunner } from "../../scripts/pnpm-runner.mjs";
describe("resolvePnpmRunner", () => {
it("uses npm_execpath when it points to pnpm", () => {
@@ -67,4 +67,25 @@ describe("resolvePnpmRunner", () => {
windowsVerbatimArguments: true,
});
});
it("builds a shared spawn spec with inherited stdio and env overrides", () => {
const env = { PATH: "/custom/bin", FOO: "bar" };
expect(
createPnpmRunnerSpawnSpec({
npmExecPath: "",
pnpmArgs: ["exec", "vitest", "run"],
platform: "linux",
env,
}),
).toEqual({
command: "pnpm",
args: ["exec", "vitest", "run"],
options: {
stdio: "inherit",
env,
shell: false,
windowsVerbatimArguments: undefined,
},
});
});
});