You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI tests: the init --install test looks for npm-cli.js under npm's global prefix #196
Ubuntu, Node.js 24.22.1, npm 11.21.1 installed in /usr/local, with a user-level npm prefix (prefix=~/.local), terminal.
What happens
tests/client/cli-agent.test.ts, test "initializes an installed npm project end to end and is idempotent", wraps the real npm in a shim. On Linux and macOS it finds the real npm's entry point with:
npm root -g names the configured global prefix, not the directory npm itself runs from. With a user prefix, a common setup that avoids sudo for global installs, that path does not exist, and the test fails inside diffci init --install:
✖ initializes an installed npm project end to end and is idempotent
AssertionError [ERR_ASSERTION]: DiffCI init failed: could not install @diffci.com/[email protected]: node:internal/modules/cjs/loader:1568
Error: Cannot find module '<home>/.local/lib/node_modules/npm/bin/npm-cli.js'
The npm on PATH is a link to its own bin/npm-cli.js (here /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js).
What you expected
The test finds the npm-cli.js that the npm on PATH runs, by following that link, and falls back to npm root -g only when it is not a link to npm-cli.js.
Regression test
The linked pull request moves the lookup into tests/helpers/npm-cli.ts. The end-to-end test above fails on main on such a machine and passes with the change; tests/client/npm-cli-path.test.ts checks the lookup with a global prefix that does not contain npm.
Activity
test(cli): find the npm-cli.js npm runs, not one under its global pre…