Skip to content

fix(gitignore): anchor "coverage/" to repo root (unblocks src/coverage/, packages/*/coverage/)#127

Merged
colbymchenry merged 1 commit into
colbymchenry:mainfrom
andreinknv:fix/gitignore-anchor-coverage
May 8, 2026
Merged

fix(gitignore): anchor "coverage/" to repo root (unblocks src/coverage/, packages/*/coverage/)#127
colbymchenry merged 1 commit into
colbymchenry:mainfrom
andreinknv:fix/gitignore-anchor-coverage

Conversation

@andreinknv
Copy link
Copy Markdown
Contributor

Summary

The coverage/ rule on line 21 of .gitignore is unanchored — it matches any coverage/ directory in the tree, not just the test-output one at the repo root. This is a real footgun: when adding a src/coverage/ module (or packages/*/coverage/ in a monorepo), git add silently 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 because git add src/coverage/ was silently swallowed. The PR shipped with __tests__/coverage.test.ts importing 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-output coverage/ at root (the original intent) while allowing source paths like src/coverage/ to be committed normally.

Test plan

  • git check-ignore -v src/coverage/foo.ts → no longer matches
  • git check-ignore -v coverage/lcov.info → still matches the root-level rule
  • No code changes; behavior is purely the gitignore semantics

Independent 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

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.
@colbymchenry
Copy link
Copy Markdown
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.

@colbymchenry colbymchenry merged commit 153fd1e into colbymchenry:main May 8, 2026
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.

2 participants