Fix unit test coverage reporting and set realistic thresholds#234
Open
Fix unit test coverage reporting and set realistic thresholds#234
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
797a2c2 to
51c469d
Compare
51c469d to
5d6a737
Compare
Coverage was reporting ~18% because V8 only tracked vitest-transformed source files, while oclif's runCommand dynamically loads compiled JS from dist/. Three fixes: 1. Enable sourceMap in tsconfig so V8 can map dist/ back to src/ 2. Include dist/src/**/*.js in coverage (where oclif-loaded code lives) 3. Add reportOnFailure: true so coverage reports even when tests fail Also delete legacy .nycrc.json (unused since Mocha→Vitest migration) and set thresholds based on actual coverage (60/55/60/60) as a don't-regress ratchet. Coverage jumps from 18% → 64% with no test changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5d6a737 to
7f5f807
Compare
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
src/**/*.ts), but oclif'srunCommanddynamically loads compiled JS fromdist/. Result: ~18% reported coverage despite good test coverage.sourceMapin tsconfig, includingdist/src/**/*.jsin coverage config, and addingreportOnFailure: trueso coverage always reports (even when tests fail)..nycrc.json: legacy Istanbul/nyc config from the Mocha era, unused since Vitest migration.Coverage: 18% → 64% with zero test changes.
Test plan
pnpm test:coverage:unitproduces a coverage table with ~64% coveragecoverage/reportOnFailure: trueensures coverage reports even with pre-existing test failurespnpm exec eslint .passes (0 errors)pnpm test:unitpasses (2195 tests, 1 pre-existing failure in spaces/locations/subscribe)🤖 Generated with Claude Code