Cover lib/selector-hide-rule directly; bump global ratchet#147
Merged
Conversation
Brings src/lib/selector-hide-rule.ts from 89.13% to 100% statements, 77.77% to 100% branches, and 88.88% to 100% lines. The factory was previously covered only transitively through the 6 rules built on it (chat-widget, cookie-banner, comments-redact, footer-redact, newsletter-modal-hide, reviews-redact); a direct test file pins its own contracts so a regression here can't silently break the union. Tests cover: - constructor validation: throws when hideLabel is omitted and removeEntirely is false; doesn't throw otherwise. - selectorsFor URL composition: alwaysOnSelectors only when no siteRules match; pattern-matched site rules merge in; non-matching patterns are dropped; multiple matches all contribute. - scan branches: empty-selectors short-circuit; candidateFilter narrows the candidate set; placeholder-element skip; inside- placeholder skip; REVEALED_ATTR skip (self) but not for other rules; REVEALED_ATTR ancestor skip; HIDDEN_ATTR skip; outermost- match dedupe. - removeEntirely: display:none + HIDDEN_ATTR + no placeholder. - rule shape: teardown present iff watchSubtrees, topFrameOnly propagates. Ratchet global thresholds 68/63/67/68 → 69/64/67/68. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Brings `src/lib/selector-hide-rule.ts` from 89.13% → 100% statements, 77.77% → 100% branches, and 88.88% → 100% lines. The factory was previously covered only transitively through the 6 rules built on it (`chat-widget-hide`, `cookie-banner-hide`, `comments-redact`, `footer-redact`, `newsletter-modal-hide`, `reviews-redact`); a direct test file pins its own contracts so a regression here can't silently break the union.
What the tests cover
Ratchet
Global thresholds 68/63/67/68 → 69/64/67/68 to lock in the gain (`src/lib` overall: 95.19% → 96.11% statements, 91.32% → 94.97% branches).
Test plan
🤖 Generated with Claude Code