tests: add c8 coverage thresholds for JS tests#47
Merged
Conversation
- Add c8 as dev dependency for V8 coverage collection - Add .c8rc.json with thresholds: 50% lines/functions/statements, 40% branches - Add 'bin/test.sh coverage' mode and 'npm run test:coverage' script - Add coverage check step to CI workflow - Update .gitignore for coverage artifacts Current coverage: 96% statements, 86% branches, 100% functions.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Greptile SummaryAdds c8-based code coverage tracking for JS tests, with conservative enforcement thresholds (50% lines/functions/statements, 40% branches). The
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["bin/test.sh"] --> B{FILTER arg?}
B -->|"all / js"| C["run_js_tests()"]
B -->|"shell"| D["run_shell_tests()"]
B -->|"coverage"| E["npx c8 node --test JS_TEST_FILES"]
B -->|"all"| D
C --> F["node --test per file<br/>with pass/fail tracking"]
D --> G["bash test scripts<br/>with pass/fail tracking"]
E --> H[".c8rc.json thresholds"]
H --> I{"Coverage ≥ thresholds?"}
I -->|Yes| J["Exit 0"]
I -->|No| K["Exit 1"]
Last reviewed commit: ece351a |
- Remove lib/**/*.mjs from c8 includes (dir doesn't exist yet) - Split CI into coverage run (JS) + shell tests (avoids double execution)
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.
Adds code coverage tracking and enforcement for JS/TS tests using c8 (V8 native coverage).
What changed
.c8rc.json— coverage config with thresholds (50% lines/functions/statements, 40% branches)bin/test.sh— newcoveragemode (bin/test.sh coverage)package.json—npm run test:coveragescript.gitignore— excludescoverage/and.c8_output/Coverage approach
Uses
c8wrappingnode --testrather than migrating to vitest. This keeps the existing test infrastructure unchanged while adding coverage tracking. c8 uses V8's built-in coverage, so there's no instrumentation overhead.Current coverage
Thresholds are set conservatively (50%/40%) to avoid blocking PRs while establishing the baseline. Can ratchet up as coverage grows.