Skip to content

refactor: remove dead code and add 100% test branch coverage#553

Merged
remarkablemark merged 1 commit into
masterfrom
refactor/index
Jul 3, 2026
Merged

refactor: remove dead code and add 100% test branch coverage#553
remarkablemark merged 1 commit into
masterfrom
refactor/index

Conversation

@remarkablemark

Copy link
Copy Markdown
Owner

What is the motivation for this pull request?

Refactor to remove dead code and achieve 100% test branch coverage.

What is the current behavior?

  • comments() had an unreachable if (c !== false) guard — comment() never returns false
  • declarations() had an unreachable if (decl !== false) guard — declaration() never returns false
  • comments() had an unreachable rules = rules || [] fallback — it is always called with a rules array argument
  • trim() falsy branch was untested — no test covered a declaration whose value is entirely a CSS comment

Branch coverage was 89.18%.

What is the new behavior?

  • Removed three dead code branches from index.js
  • Added snapshot test case 'parses declaration with comment-only value' (e.g. color: /* red */;) to cover the trim('') branch

Branch coverage is now 100%.

Checklist:

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1d9d45c) to head (37f5d35).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #553   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          103       100    -3     
  Branches        20        17    -3     
=========================================
- Hits           103       100    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mergify

mergify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@remarkablemark remarkablemark self-assigned this Jul 3, 2026
@remarkablemark remarkablemark merged commit 4f950d6 into master Jul 3, 2026
13 checks passed
@remarkablemark remarkablemark deleted the refactor/index branch July 3, 2026 20:01
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