fix(cli): the npx shim test runs a stub npx, not the runners - #4175
Open
miguel-heygen wants to merge 2 commits into
Open
miguel-heygen wants to merge 2 commits into
miguel-heygen wants to merge 2 commits into
Conversation
The test spawned the host npx through cmd.exe, which timed out on the Windows runner. It now puts a stub npx first on PATH and runs the built command against it, so shim resolution is still exercised with no host npx and no network.
Windows can briefly lock a just-run temp dir; a cleanup error would hide the assertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The
npxCommandunit test that ran the host's realnpx --versionthroughcmd.exetimed out on the Windows CI runner (spawnSync cmd.exe ETIMEDOUT), so an unrelated PR could go red on a machine-load problem. A unit test should not depend on the runner'snpxor the network.The test now writes a stub
npx(npx.cmdon Windows) into a temp folder, puts that folder first onPATH, and runs the commandbuildNpxCommandbuilds. It expects the stub's output. Socmd.exe /d /s /c npx.cmdresolution is still exercised end to end, with no hostnpx, no network and a 15 second bound. The test itself is not retried.The per-platform command-shape tests are unchanged.
Verification
npxCommand.test.ts: 7 pass on Linux at the first head. The last commit only addsmaxRetries: 3, retryDelay: 100to the temp-dir cleanup (a Windows file lock could otherwise hide the assertion); it was not re-run on the remote runner, so CI on this head is its verification.PATH, the new test fails (expected '10.9.4' to be '9.9.9', the real npx's answer), so it does test the stub path.cli-npx-shimCI job runs this file on Ubuntu, macOS and Windows, which is the check for thecmd.exeandnpx.cmdpath.Review
An independent review report is attached to the gate record for this head.