Skip to content

fix(ci): add vitest coverage thresholds to prevent silent regressions#655

Open
hanthor wants to merge 1 commit into
mainfrom
hanthor/fix-vitest-coverage-thresholds
Open

fix(ci): add vitest coverage thresholds to prevent silent regressions#655
hanthor wants to merge 1 commit into
mainfrom
hanthor/fix-vitest-coverage-thresholds

Conversation

@hanthor
Copy link
Copy Markdown
Member

@hanthor hanthor commented May 29, 2026

Summary

Closes #651

vite.config.ts reports coverage via @vitest/coverage-v8 but has no thresholds block, so PRs that delete tests still pass CI.

Adds conservative 50% floors across statements, branches, functions, and lines. These can be raised progressively as coverage improves.

Changes

  • vite.config.ts: add thresholds block to the coverage config

Test plan

  • Run npm run test -- --coverage and confirm it fails if coverage drops below 50%
  • Confirm CI passes on this branch at current coverage levels

Summary by CodeRabbit

  • Chores
    • Implemented minimum code coverage thresholds to maintain and enforce code quality standards.

Review Change Stack

Without thresholds, coverage is collected but never enforced -- a PR
that deletes tests still passes CI. Set conservative 50% floors across
statements, branches, functions, and lines to start blocking regressions.

Closes #651

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb426eaf-9e19-4fd7-ae5f-a134f5617035

📥 Commits

Reviewing files that changed from the base of the PR and between b3902e1 and f94dfd2.

📒 Files selected for processing (1)
  • vite.config.ts

📝 Walkthrough

Walkthrough

This PR enforces test coverage quality gates by adding minimum coverage thresholds (50%) to the Vite test configuration in vite.config.ts. Coverage is now measured and validated, preventing PRs that reduce test coverage from passing CI checks.

Changes

Test Coverage Thresholds

Layer / File(s) Summary
Coverage threshold enforcement
vite.config.ts
test.coverage.thresholds block sets minimum coverage requirements: 50% for statements, branches, functions, and lines, ensuring test coverage is enforced rather than only reported.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A threshold is placed, a line in the sand,
Coverage enforced throughout the land!
Fifty percent now stands as guard,
No test-deleting PRs slip past our card.
Quality blooms where enforcement takes hold! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding vitest coverage thresholds to the CI configuration to prevent coverage regressions.
Linked Issues check ✅ Passed The pull request fully implements the requirements from issue #651 by adding 50% coverage thresholds for statements, branches, functions, and lines to vite.config.ts.
Out of Scope Changes check ✅ Passed All changes are in scope; only vite.config.ts was modified to add the coverage thresholds configuration as specified in issue #651.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hanthor/fix-vitest-coverage-thresholds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member Author

@hanthor hanthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review ✅

Changes: 1 file, +6 lines. vite.config.ts only.

Correctness

  • ✅ Thresholds block is well-formed per Vitest coverage docs
  • ✅ All four standard metrics covered (statements, branches, functions, lines)
  • ✅ 50% is conservative and safe — won't break existing CI

Closes #651

  • ✅ Addresses the quality finding exactly as specified

Verdict

Simple, correct, minimal. LGTM.

Copy link
Copy Markdown
Member Author

@hanthor hanthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PR #655 — add vitest coverage thresholds

Minimal, correct fix for #651. Adds coverage thresholds to vitest config.

What's good

  • 50% across all metrics is a reasonable floor — prevents zero-coverage regressions without blocking incremental work
  • Single file, config-only change
  • v8 provider + lcov reporter already configured, this just adds the gate layer

Verdict

LGTM. Ready to merge.

Copy link
Copy Markdown
Member Author

@hanthor hanthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix — adds vitest coverage thresholds to prevent silent regression. Closes #651. LGTM.

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.

[quality] missing-workflow: vitest coverage threshold gate

1 participant