1 Commits
Author SHA1 Message Date
Ryan Duguid 9a399b28f6 fix(scripts): run npm through its Node entry point in the MCP package check
scripts/test-mcp-package.mjs spawned "npm" without a shell, which fails on
Windows with spawn npm ENOENT because npm is a .cmd shim there. Under
"npm run test:mcp" the npm CLI is known: run process.execPath with the
npm-cli.js entry point from npm_execpath, and fall back to "npm" on PATH
elsewhere. A direct Windows run without that entry point now explains the
supported command instead of failing later.

The selection lives in scripts/lib/npm-command.mjs so the unit tests import
it directly. It recognises the npm CLI by its entry-point filename, parsed
with the path rules of the platform under test, rather than by the
configurable npm_config_user_agent. Tests cover npm on both platforms,
paths with spaces, a customised user agent, a direct Windows run, an empty
npm_execpath and other package managers.

(cherry picked from commit 2b4ac4ac0c)
2026-10-22 19:42:44 -07:00