Skip to content

Add native JavaScript coverage for browser runtime #337

@aallan

Description

@aallan

The browser parity tests (tests/test_browser.py) verify that runtime.mjs produces the same results as the Python runtime, but we have no code coverage metrics for the JavaScript side. Uncovered JS branches are invisible to codecov (which only sees Python coverage from pytest-cov).

Proposal

Add c8 (V8 built-in coverage) to the browser parity test runs. The parity tests already execute via Node.js 22 through harness.mjs, so wrapping with c8 should be straightforward.

Steps

  1. Add c8 as a dev dependency (or use npx c8)
  2. Run parity tests through c8 node harness.mjs ... to generate coverage
  3. Export as lcov and upload to codecov alongside the Python coverage report
  4. Optionally set a JS-specific coverage threshold

Benefits

  • Identifies dead code and untested branches in runtime.mjs
  • Catches regressions when adding new host imports (e.g. Map, Set, future types)
  • Unified coverage view in codecov (Python + JS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI/CD and GitHub ActionstoolingIssue around tooling built for the language (e.g. package managers, IDE plug-ins)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions