- App bundler changes — instrument your app with Istanbul (requires app source code, done by app team)
- Test repo changes — enable coverage collection in your test fixtures (can be done by Empirical agents)
- Build final report — download coverage artifacts and generate an HTML report (requires app source code, done by app team)
App repo changes
Add thevite-plugin-istanbul plugin to your Vite config to instrument your source code with Istanbul coverage hooks.
If you are running tests against a deployed URL (not localhost), also add forceBuildInstrument: true to ensure instrumentation is
included in production builds.
Tests repo changes
@empiricalrun/playwright-utils 0.43.0+ includes coverage collection utilities. In your test fixture file, enable
coverage by passing { collectCoverage: true } to baseTestFixture.
window.__coverage__ data from every page before it closes and attaches
the Istanbul coverage JSON files to the test report. These files are uploaded like other artifacts (e.g. videos).
Build final report
To build the final coverage report withnyc, we will first download the coverage JSON files from Empirical’s
storage buckets, and then build the report.
First, fetch the test run details using the Get Test Run API, then download the
Playwright JSON report from the summary_url property.
.nyc_output:
nyc from your app source directory: