Restore 100% coverage under Vitest 4 (5.2.0) - #373
Merged
Merged
Conversation
Vitest 4's AST-based remapper counts the implicit else of every if, reports uncalled arrow functions and binds v8 ignore hints to a single node, which left 42 branches and 2 functions uncovered after the bump. coverage.thresholds now pins all four metrics at 100% so CI fails on the next drop instead of reporting it quietly. Also fixes bugs surfaced while covering those paths: - a frozen or getter-based default LogObj made every log call throw - a structurally hostile source map threw a TypeError out of the log call - worker transport flush() rejected forever after a failed spawn - restoreConsole() left a forwarder on a console that lacked the method
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #373 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 53 53
Lines 4642 4628 -14
Branches 1425 1361 -64
=========================================
- Hits 4642 4628 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Follow-up to #370 before the 5.2.0 release. The Vitest 4 bump left coverage at 99.95 / 98.71 / 99.68 while CI stayed green: the new AST-based remapper counts the implicit
elseof everyif, reports uncalled arrow functions, and bindsv8 ignorehints to a single AST node (sonext 3counts stopped working), and neither Codecov nor vitest enforced a floor.Coverage
v8 ignore elsehints only for defensive paths no caller can reach.coverage.thresholdsinvitest.config.tsnow pins all four metrics at 100%, sonpm run coverage(the Node 20 CI job) fails on the next drop.Fixed (found while covering those paths, all in the 5.2.0 changelog)
Cannot assign to read only property."sections":[null], non-stringmappings) threw aTypeErrorout of the log call.flush()rejected forever after a failednew Worker()although writes had already gone inline.restoreConsole()left tslog's forwarder on a console method that did not exist beforewrapConsole().Verified locally: Node 24 (1675 tests, 100% coverage), Bun, Chromium browser suite, tsgo, biome, doc-sync.