GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(test): the pinned-Node restart finds the global vp when a local v… · pechhe/t3code@2b8029e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • test-landing.test.ts
    • test-landing.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/test-landing.test.ts‎

Copy file name to clipboardExpand all lines: scripts/test-landing.test.ts
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
planCandidate,
2222
plannedRuns,
2323
pinnedNodeDecision,
24+
withoutLocalBins,
2425
readQuarantine,
2526
readWorkspaces,
2627
relativeImports,
@@ -1426,6 +1427,11 @@ describe("pinned node", () => {
14261427
);
14271428
});
14281429

1430+
it("drops project-local bin directories so the restart finds the global vp", () => {
1431+
const path = ["/repo/node_modules/.bin", "/usr/bin", "/repo/apps/web/node_modules/.bin/"];
1432+
assert.strictEqual(withoutLocalBins(path.join(NodePath.delimiter)), "/usr/bin");
1433+
});
1434+
14291435
it("runs on the Node it already has when that is the pin, or when the invocation only plans", () => {
14301436
assert.deepStrictEqual(pinnedNodeDecision({ pin, running: pin, restarted: false, args: [] }), {
14311437
kind: "run",
Collapse file

‎scripts/test-landing.ts‎

Copy file name to clipboardExpand all lines: scripts/test-landing.ts
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ export function pinnedNodeDecision(input: {
7272
};
7373
}
7474

75+
/** A project-local `vp` has no `env` command, so the restart must find the global one. */
76+
export function withoutLocalBins(pathValue: string | undefined): string {
77+
return (pathValue ?? "")
78+
.split(NodePath.delimiter)
79+
.filter((entry) => !/[\\/]node_modules[\\/]\.bin[\\/]?$/.test(entry))
80+
.join(NodePath.delimiter);
81+
}
82+
7583
function runOnPinnedNode(args: ReadonlyArray<string>) {
7684
const decision = pinnedNodeDecision({
7785
pin: PINNED_NODE,
@@ -86,7 +94,11 @@ function runOnPinnedNode(args: ReadonlyArray<string>) {
8694
}
8795
const child = NodeChildProcess.spawnSync(decision.executable, decision.args, {
8896
stdio: "inherit",
89-
env: { ...process.env, T3_LANDING_PINNED_NODE: process.versions.node },
97+
env: {
98+
...process.env,
99+
PATH: withoutLocalBins(process.env.PATH),
100+
T3_LANDING_PINNED_NODE: process.versions.node,
101+
},
90102
});
91103
// A spawn error means vp is missing; any exit status is the restarted gate's own result, and the
92104
// restarted run (or vp, when it cannot provide the runtime) has already said why it failed.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.