Skip to content

Make test:integration runnable outside a POSIX shell - #57

Merged
nedonatelli merged 1 commit into
mainfrom
fix/integration-script-portability
Sep 7, 2026
Merged

Make test:integration runnable outside a POSIX shell#57
nedonatelli merged 1 commit into
mainfrom
fix/integration-script-portability

Conversation

@nedonatelli

Copy link
Copy Markdown
Owner

npm run test:integration inlined four things cmd.exe does not have, so the entire integration suite was unrunnable on Windows:

rm -rf out/src/test/integration && ... && { find src -name '*.js' \
  -not -path 'src/test/*' -delete 2>/dev/null || true; } && vscode-test

npm runs scripts through cmd.exe on Windows, where rm and find do not exist, /dev/null is not a path, and { ...; } is not a group. Verified directly rather than assumed:

cmd /c "rm -rf out/src/test/integration"
-> 'rm' is not recognized as an internal or external command

Same class as the mkdir -p in copy-grammars (3c1bae3), which silently skipped every tree-sitter suite instead of failing — that one cost real coverage before anyone noticed.

What changed

scripts/integration-clean.mjs in two modes, replacing the shell steps:

  • pre — remove the previous integration build output
  • post — prune stray compiled .js outside src/test, swallowing per-file errors to match the || true the shell version ended with. A stray file that cannot be removed must not fail the test run.

How it was found

Audited all 40 npm scripts for POSIX-only constructs after two of them turned out to be broken on Windows. This was the only remaining one. The two other regex hits were false positives — cross-env already handles a second VAR= on the same line.

🤖 Generated with Claude Code

The script inlined four things cmd.exe does not have:

  rm -rf out/src/test/integration && ... && { find src -name '*.js' \
    -not -path 'src/test/*' -delete 2>/dev/null || true; } && vscode-test

npm runs scripts through cmd.exe on Windows, so `rm` and `find` do not exist,
`/dev/null` is not a path, and `{ ...; }` is not a group. Verified directly:

  cmd /c "rm -rf out/src/test/integration"
  -> 'rm' is not recognized as an internal or external command

The whole integration suite was therefore unrunnable on Windows. Same class as
the `mkdir -p` in copy-grammars (3c1bae3), which silently skipped every
tree-sitter suite rather than failing.

Replaced with scripts/integration-clean.mjs in two modes: `pre` removes the
previous build output, `post` prunes stray compiled .js outside src/test.
The post step swallows per-file removal errors, matching the `|| true` the
shell version ended with -- a stray file that cannot be deleted must not fail
the test run.

Found by auditing all 40 npm scripts for POSIX-only constructs after two of
them turned out to be broken on Windows. This was the only remaining one; the
two other regex hits were false positives (cross-env already handles a second
VAR= on the same line).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

✅ All checks passed

Check Status
Type check ✅ success
Lint ✅ success
Tests ✅ success

Posted by SideCarAI-Bot

@nedonatelli
nedonatelli merged commit 62f642c into main Sep 7, 2026
4 checks passed
@nedonatelli
nedonatelli deleted the fix/integration-script-portability branch September 7, 2026 00:08
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.

1 participant