chore(test): discover Bats tests repo-wide, not just test/#132
Open
taminomara wants to merge 1 commit into
Open
chore(test): discover Bats tests repo-wide, not just test/#132taminomara wants to merge 1 commit into
taminomara wants to merge 1 commit into
Conversation
Change the `npm test` script to find every `*.bats` file outside node_modules and hand them to Bats, instead of recursing only `test/`. This lets a script's tests sit next to the script they cover, while `test/` stays home to harness-level checks. Bats has no built-in path or directory exclusion (its `--filter` family matches test names, not files, and there is no `.batsignore`), so a `find ... -prune | xargs` pipeline shapes the file list. It also prunes any nested node_modules and still runs not-yet-committed tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VxmMsZfzA4d37Uh1rTfEDG
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
Change the
npm testscript so Bats discovers every*.batsfile in the repo (outsidenode_modules) instead of only recursingtest/:This lets a script's tests sit next to the script they cover (e.g.
scripts/foo.shcovered byscripts/foo.bats), whiletest/stays home to harness-level checks likesanity.bats.Why
find, not a Bats flagBats has no built-in path or directory exclusion. Its
--filter/--negative-filter/--filter-tagsflags all match test names/tags, not file paths — and a filtered-out file is still loaded and its file-level code executed anyway. There is no.batsignoreand no.gitignoreawareness; file discovery is driven purely by the positional path arguments. So shaping the list withfindis what keepsnode_modules(and any nestednode_modules) out.findalso still runs not-yet-committed tests, which agit ls-files-based list would skip.Sequencing
This is the config-only prerequisite. A follow-up MR relocates the existing
review-skill-or-agentBats tests next to their scripts and updates thesanity.batscomment. The CONTRIBUTING example it documents (scripts/detect-git-context.bats) only appears onmainonce that follow-up lands. Splitting them keeps this discovery change reviewable on its own.Verification
The new pipeline discovers and runs
test/sanity.batsgreen on this branch. A failing test propagates correctly (xargsexits 123, so CI fails).🤖 Generated with Claude Code
https://claude.ai/code/session_01VxmMsZfzA4d37Uh1rTfEDG