Skip to content

test(cli): find the npm-cli.js npm runs, not one under its global prefix - #240

Merged
adityankale190895 merged 5 commits into
DiffCI:mainfrom
FredApps:test/cli-agent-npm-cli-path
Nov 18, 2026
Merged

adityankale190895 merged 5 commits into
DiffCI:mainfrom
FredApps:test/cli-agent-npm-cli-path

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #196

Changed behavior

This changes only tests. The init --install test in tests/client/cli-agent.test.ts now gets the path of npm-cli.js from a new npmCliPath() helper in tests/helpers/npm-cli.ts. The helper follows the real path of the npm executable on PATH, which is the npm that actually runs, and falls back to npm root -g only when that does not lead to npm-cli.js. On a machine where npm's global prefix is not the directory npm itself is installed in (for example a user prefix in ~/.local), the test no longer looks for a file that does not exist.

Validation

  • tests/client/npm-cli-path.test.ts is new. It checks that the helper returns an existing npm-cli.js.
  • On a machine with a user global prefix, the init --install test fails on main with Cannot find module .../npm/bin/npm-cli.js and passes with this change.
  • npm run typecheck in packages/diffci-cli passes.
  • npm test in packages/diffci-cli: the only remaining failure is the help test in CLI tests: cli-agent.test.ts expects the old verify usage line and fails on main #193, which has its own pull request.
  • New files are added to release-files.json.

Includes #203. main fails the stale diffci verify help-text test (#193), which made Merge gate smoke red here. This branch merges #203's branch in, so its CI reflects this change alone. Merge #203 first, or merge this PR alone (GitHub then marks #203 as merged). The release-files.json entry for tests/helpers/npm-cli.ts is now one line away from #202's, so the two no longer conflict.

@FredApps

Copy link
Copy Markdown
Contributor Author

CI diagnosis for the failed Merge gate smoke job (run 44129818181):

The job's diffci verify step ran the affected tests in tests/client/cli.test.ts and failed on one test, agent-facing CLI commands > prints check and init as first-class commands. That test also fails on main (40aa308), because its expected help text is out of date. It is tracked in #193 and fixed by #203. The other cli.test.ts failure on main, initializes an installed npm project end to end and is idempotent, passed in this run, which is the change this PR makes (#196).

The failure is not caused by this PR. It should clear once #203 is merged and this branch is updated from main.

@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-review (FredApps, head 38b9306). Not an approval.

Checked

Fixed: nothing needed.

Open

…ffCI#202

The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict.

Signed-off-by: FredApps <[email protected]>
…ses before DiffCI#203 lands

Main fails the stale verify help-text test (DiffCI#193), which DiffCI#203 fixes. With it merged in, this PR's CI reflects its own change.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 01:10
@adityankale190895
adityankale190895 merged commit 5d38919 into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI tests: the init --install test looks for npm-cli.js under npm's global prefix

2 participants