fix(gitignore): anchor "coverage/" to repo root (unblocks src/coverage/, packages/*/coverage/)#127
Merged
colbymchenry merged 1 commit intoMay 8, 2026
Conversation
The unanchored "coverage/" rule (intended to ignore the test-output directory at repo root) silently matches any "coverage/" directory in the tree. This bit a real PR: src/coverage/ was added but never made it into the commit because git add silently dropped the files. The PR shipped with the test importing a module that didn't exist. Anchor the rule to "/coverage/" so it only ignores root-level test output, allowing src/coverage/, packages/*/coverage/, etc. to be committed normally.
Owner
|
Reviewed and merging. Anchoring to root is the correct fix — unanchored matches at any depth, which is exactly the silent-swallow footgun you flagged. Thanks. |
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
The
coverage/rule on line 21 of.gitignoreis unanchored — it matches anycoverage/directory in the tree, not just the test-output one at the repo root. This is a real footgun: when adding asrc/coverage/module (orpackages/*/coverage/in a monorepo),git addsilently drops the files with no warning.This bit me on PR #124 — the
src/coverage/module was written and tested locally, but never made it into the commit becausegit add src/coverage/was silently swallowed. The PR shipped with__tests__/coverage.test.tsimporting a module that didn't exist; whoever rebases or merges it hits a build failure that's confusing to debug.The fix anchors the rule to the repo root:
/coverage/. This still ignores the test-outputcoverage/at root (the original intent) while allowing source paths likesrc/coverage/to be committed normally.Test plan
git check-ignore -v src/coverage/foo.ts→ no longer matchesgit check-ignore -v coverage/lcov.info→ still matches the root-level ruleIndependent of the issue #120 merge guide — this can land any time and helps every future PR that touches anything named
coverage/outside the repo root.🤖 Generated with Claude Code