Repository navigation
fix(tests): invoke the CLI without npx so the suite runs on Windows - #77
Open
HeversonSilva-gif wants to merge 1 commit into
Open
HeversonSilva-gif wants to merge 1 commit into
HeversonSilva-gif wants to merge 1 commit into
Conversation
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.
Summary
npm testfails on Windows before any assertion is reached, because the test helpershells out through
npx.src/__tests__/invoke-cli.tscalls:On Windows
npxisnpx.cmd, andexecFileSyncwithout a shell cannot launch it. Bothspellings fail:
execFileSync('npx', …)ENOENT— there is no extensionlessnpxexecFileSync('npx.cmd', …)EINVAL— Node refuses to spawn.cmd/.batwithout a shell since the CVE-2024-27980 mitigation (18.20.2 / 20.12.2 / 21.7.3)Either way the throw lands in the
catch, which returnsexitCode: 1with emptystdoutand
stderr. Every test that asserts an exit code or reads output then fails against anempty string, which is why the failures look like
expected 1 to be 2andexpected '' to contain …rather than anything to do with spawning.This is invisible in CI, which is
ubuntu-lateston every job.Related Issue
None open — found while running the suite locally.
Type of Change
Testing
Windows 11, Node 22.14.0, npm 10.9.2, at
7b8c868, with a~/.claude/settings.jsonpresent so agent detection behaves as it does in CI.
add,list,remove,submitandupdatego fully green;installerdrops from 10failures to 2.
npm run build,npm run typecheck,npm run lintandnpm run format:checkall still exit 0.The 14 that remain are unrelated to this change and I have not touched them:
installer.test.ts(2) —EPERM … symlink. Creating symlinks on Windows needs elevatedprivileges or Developer Mode. That is the environment, not the code.
agents.test.ts(12) — the assertions compare against POSIX literals such as.claude/skillsand/home/user/.claude, whilepath.joinreturns backslashes onWindows. Real, but it is a separate change across a dozen assertions and I did not want
to bundle an opinion about it into a one-line fix. Happy to open it separately if you
want it.
Checklist
lintandformat:checkclean)tests execute at all; a test asserting the helper can spawn would be testing the
helper with the helper
unrelated. I would rather say so than tick this
npm run build)Note on the approach
Running
node --import tsxinstead of patching thenpxname keepsexecFileSyncwithouta shell, so the injection protection the original comment describes is unchanged.
--importneeds Node 18.19+ or 20.6+;
actions/setup-nodewithnode-version: 18resolves to 18.20.x,so all three entries in the CI matrix support it.