Add native JavaScript coverage for browser runtime#343
Conversation
Use V8 built-in NODE_V8_COVERAGE to collect JS coverage during browser parity tests. After tests complete, npx c8 converts the accumulated V8 data to LCOV and uploads to Codecov with a javascript flag. Zero changes to test_browser.py — coverage is collected automatically via environment variable inheritance. - CI: Add coverage steps to browser-parity job - codecov.yml: Configure python/javascript flags with carryforward - conftest.py: Opt-in local JS coverage via VERA_JS_COVERAGE=1 - .gitignore: Add node_modules/ and .c8_output/ - Docs: Update TESTING.md, CLAUDE.md, CONTRIBUTING.md Closes #337 Co-Authored-By: Claude <noreply@anthropic.invalid>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds V8/Node JavaScript coverage for browser parity tests: test harness writes V8 coverage, CI generates LCOV via c8 and uploads it to Codecov under a Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #343 +/- ##
==========================================
- Coverage 95.37% 91.96% -3.42%
==========================================
Files 45 47 +2
Lines 16141 17849 +1708
Branches 0 211 +211
==========================================
+ Hits 15395 16415 +1020
- Misses 746 1430 +684
- Partials 0 4 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Split project/patch status into per-flag checks so JS coverage (63%) does not drag down the Python metric (95%). Mark JS checks as informational until the baseline stabilises. Co-Authored-By: Claude <noreply@anthropic.invalid>
|
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
Status, support, documentation and community
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/conftest.py`:
- Around line 34-44: The subprocess.run call that invokes "npx c8 report" in the
teardown currently has no timeout and can hang; update the teardown to call
subprocess.run([...], check=False, timeout=<reasonable_seconds>) and catch
subprocess.TimeoutExpired around that call (referencing subprocess.run and the
"npx c8 report" invocation and cov_dir) so the test suite won’t block — on
timeout log or print a concise warning and continue/cleanup instead of letting
pytest hang.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e2e11afe-ff49-441f-9634-011ae1d8859b
📒 Files selected for processing (7)
.github/workflows/ci.yml.gitignoreCLAUDE.mdCONTRIBUTING.mdTESTING.mdcodecov.ymltests/conftest.py
Co-Authored-By: Claude <noreply@anthropic.invalid>
|
The JS coverage setup uses a clever pattern: V8's built-in coverage (via NODE_V8_COVERAGE env var) collects raw coverage data during normal Node.js execution — no instrumentation or source transforms needed. c8 then converts this into lcov format that Codecov understands. The codecov.yml flags system means Python and JS coverage are evaluated independently, so a 63% JS score won't block PRs that only touch Python code. |
Summary
NODE_V8_COVERAGEenv varnpx c8 reportand upload to Codecov withjavascriptflagcodecov.ymlwithpython/javascriptflags andcarryforward: truetests/conftest.pywith opt-in local JS coverage (VERA_JS_COVERAGE=1)test_browser.py— coverage is collected via env var inheritanceHow it works
Node.js writes V8 coverage JSON for every
nodeprocess whenNODE_V8_COVERAGEis set. Since_run_node()callssubprocess.run()withoutenv=, child processes inherit the parent environment automatically. Each subprocess writes uniquely-named coverage files. After all tests,npx c8 reportmerges them into a single LCOV file.Local usage
Current JS coverage baseline
Closes #337
Test plan
VERA_JS_COVERAGE=1 pytest tests/test_browser.py -v -sprints JS coverage tablepython scripts/check_doc_counts.pypasses🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Tests
Documentation