Skip to main content
Code coverage shows how much of your application code runs during tests. TestDino collects coverage from your Playwright tests, merges data across shards, and displays a per-file breakdown on the dashboard.
WarningCode coverage requires @testdino/playwright. See Real-Time Streaming for setup.

Quick Reference

Coverage Metrics

TestDino tracks four standard coverage metrics:

Prerequisites

  • @testdino/playwright installed (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 global window.__coverage__ object that TestDino reads after each test.
WarningInstrumented builds are for testing only. Never deploy them to production. Instrumentation slows performance by 10-30%, increases bundle size by 2-3x, and exposes your source code file structure.
Pick the method that matches your build tool:
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:
babel.config.json
Build with instrumentation enabled:
Only use instrumented builds for test environments. All other environments should use regular builds.

Enable Coverage

Add the coverage 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 reads window.__coverage__ from the browser after each test finishes. @testdino/playwright then merges all the collected data and sends it to TestDino.

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:
Step 2: Run each shard:
How merging works: The server takes the union of covered lines from every shard. If shard 1 covers lines 1-50 of 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, or window.__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

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=test or VITE_COVERAGE=true
  • coverage.enabled is set to true in the @testdino/playwright config
  • Your test files import test from @testdino/playwright (not @playwright/test)
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.
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.
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.
Enable debug logging to see what @testdino/playwright collects:
Check the console for messages prefixed with [TestDino].

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