Repository navigation
Drop Codecov and set coverage thresholds in Vitest - #4238
Merged
Merged
Conversation
CI no longer uploads coverage to Codecov. Instead, Vitest fails the run when coverage drops below `coverage.thresholds`, and lists the files that aren't fully covered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nstepien
marked this pull request as ready for review
November 1, 2026 01:18
Collaborator
Author
|
Merging this. |
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.
Codecov's status check was informational, so it never blocked a PR. This removes Codecov entirely: the upload step,
.github/codecov.yml, and the README badge. Instead, Vitest fails the test run when coverage drops belowcoverage.thresholds. Coverage is still only collected in theCIworkflow, or with--coverage, so othervp testruns are unaffected.The thresholds are the current coverage, rounded down:
statementsandfunctionshave no threshold. With each file and function insrc/in turn losing all its coverage,branchesandlinesfailed on every case that any threshold failed on, whilestatementsandfunctionsnever failed withoutlinesalso failing. This only simulates one file or function at a time.CI, which also runs the visual tests, reports about the same coverage as local runs, within 0.1 points. Branch coverage varied slightly over six local runs: a couple of branches depend on timing, e.g., in
useScrollState, and even the total number of branches varied (2022–2027).lineshas the least headroom, about 0.2%, or four lines, against about 0.3%, or seven branches, forbranches.The
jsonreporter only fed Codecov. It's replaced by atexttable of the files that aren't fully covered, with their uncovered lines, so CI's log shows what lacks coverage when a threshold fails.maxCols: 0keeps file names whole: without a terminal, the table is truncated to 80 columns (e.g.,...eaderCell.tsx).AGENTS.mdnow says to validate withvp run ci --coverage, which also checks the thresholds.The
coveragedirectoryWith no reporter writing files, Vitest deletes the empty
coveragedirectory after the run (cleanAfterRun), so CI no longer creates it upfront. Vite Task records directory listings after the run, so creating it beforehand would make thetesttask miss the cache every time. Locally, with the coverage settings of CI, a secondvp run testreplayed the cache, and a third one, aftermkdir coverage, missed with "'coverage' added in workspace root".Alternatives
vp run test, e.g., withvp test --coverageas the task's command, would letvp run cicheck the thresholds without the--coverageflag, whilevp test <files>stays unaffected. Locally, the full suite took 33–41 s with coverage, against 30–32 s without.thresholds.autoUpdateraises the thresholds when coverage exceeds them, but does so by rewritingvite.config.tsafter a full run.After merging
The
CODECOV_TOKENsecret, and the Codecov app's access to the repository, can be removed.vp run typecheck,vp check,vp run eslint,vp pack, andvp buildpass, and so does the full suite with coverage enabled, locally and in CI.🤖 Generated with Claude Code