Quick Reference
Coverage Metrics
TestDino tracks four standard coverage metrics:Prerequisites
@testdino/playwrightinstalled (CLI reference)- TestDino API token (generate one)
- Your application instrumented with Istanbul so
window.__coverage__is available in the browser
Instrument Your Application
Instrumentation adds small tracking counters around every statement, branch, and function in your code. When your app runs, these counters record what was executed. The result is stored in a globalwindow.__coverage__ object that TestDino reads after each test.
Pick the method that matches your build tool:
- babel-plugin-istanbul
- vite-plugin-istanbul
- nyc instrument
Best for React apps using Babel (Create React App, Next.js with Babel, etc.).Install the plugin:Add it to your Babel config so it only runs during test builds:Build with instrumentation enabled:
babel.config.json
Recommended Build Strategy
Only use instrumented builds for test environments. All other environments should use regular builds.Enable Coverage
Add thecoverage option to @testdino/playwright in your Playwright config:
playwright.config.ts
Coverage Options
Whenever coverage is collected, an Istanbul HTML report is written to
./coverage/index.html. There is no option to turn it off or change the directory.
Use the Coverage Fixture
The fixture is the piece that readswindow.__coverage__ from the browser after each test finishes. @testdino/playwright then merges all the collected data and sends it to TestDino.
- Auto-fixture (Recommended)
- Manual fixture
Change your import from Coverage collection runs automatically after each test. No other code changes needed.
@playwright/test to @testdino/playwright. Everything else stays the same:tests/example.spec.ts
Run Tests
1
Start the instrumented application
Run your app using the instrumented test build:
2
Set your API token
3
Run Playwright tests
4
Review results
After tests complete, the console prints a coverage summary table.Open
./coverage/index.html for the full Istanbul HTML report.Open the test run in TestDino and select the Coverage tab to see overall metrics and a per-file breakdown.Sharded Runs
When you split tests across multiple CI shards, each shard collects coverage only for the tests it runs. TestDino merges all shard data into one combined report. Step 1: Set a CI run ID so all shards group into one test run:auth.ts and shard 2 covers lines 30-80, the merged report shows lines 1-80 as covered.
Example CI Workflow
.github/workflows/coverage.yml
Data Handling
TestDino uploads only coverage metrics (percentages and hit counts per file). No source code, raw coverage maps, orwindow.__coverage__ payloads are stored on the server.
NoteWhen
window.__coverage__ is not present in the browser, @testdino/playwright skips coverage collection and proceeds normally. Tests run without any performance impact.Troubleshooting
No coverage data collected
No coverage data collected
Open your app in the browser and type
window.__coverage__ in the DevTools console. If it returns undefined, your app is not instrumented.Check that:- Your build command uses
NODE_ENV=testorVITE_COVERAGE=true coverage.enabledis set totruein the@testdino/playwrightconfig- Your test files import
testfrom@testdino/playwright(not@playwright/test)
Coverage only from one browser
Coverage only from one browser
This is expected when Playwright’s top-level
projects array defines a single browser, or when you run with --project=chromium. To collect coverage from all browsers, run without a project filter.Missing files in coverage report
Missing files in coverage report
Only files that run during tests appear in the report. If a file shows 0% or is missing, no test triggered the code path that imports it.To include all source files (even untouched ones), configure your Istanbul tool’s
include/exclude settings to cover the full source directory.Branch coverage is lower than line coverage
Branch coverage is lower than line coverage
This is normal. Branch coverage counts both sides of every
if/else. If your tests only exercise one side (for example, the success path but not the error path), branch coverage drops while line coverage stays higher.Debug coverage collection
Debug coverage collection
Enable debug logging to see what Check the console for messages prefixed with
@testdino/playwright collects:[TestDino].Related
Test Run Coverage
Per-run coverage breakdown by file
Coverage Trend
Coverage trends across runs and environments
Node.js CLI
CLI setup and options
CI Integration
Set up Playwright in GitHub Actions