Integrate with your framework
You can keep your existing test runner. Use the CLI to collect coverage from a Node.js command, or the API to import data from browser tests or a runner that already collects coverage. If you already use node:test, use mcr test. Check framework-specific integrations before wiring it up yourself.
CLI
For Node.js test commands, prefix your existing command with mcr to collect V8 coverage and generate reports:
npx mcr -- your-test-runner --your-argumentsSee Command line for options. For browser tests, use the framework's coverage collection API and pass the collected data to MCR as described below.
API
Collect coverage data in your test hooks or fixtures, then add it to an MCR report instance (CoverageReport) with await mcr.add(coverageData). After all tests finish, call await mcr.generate() to generate the reports.
This approach gives you control over when coverage is collected and submitted. See V8 collection, Istanbul collection, and Multiple processes for collection and cross-process integration details.