Menu

1 / 2

Two test runtimes, two coverage reports, one fragile merge

DEV Community·Kevin Julián Martínez Escobar·7 months ago
#xYEizFcM
#testing#twd#coverage#playwright#tests
Reading 0:00
15s threshold

You have unit tests in Vitest (or Jest). You have E2E tests in Playwright. CI runs both. Coverage works for each, until you try to look at a single number.

Then it gets weird.

Two runtimes, two coverage outputs

Unit tests run in Node, instrumented by V8 or istanbul. Playwright runs your real app in a real browser. Each produces its own coverage data. Stitching them together usually means:

nyc merge (or a custom step) combining coverage-final.json files

Reconciling source maps between Vitest's transform pipeline and Playwright's

Hoping both tools agree on file paths

It works, until it doesn't. A path mismatch silently drops files from the merged report. A Playwright run on a different Node version emits slightly different paths. Coverage drops by 12% and nobody knows why.

The deeper issue: you're not really merging coverage. You're merging evidence that two different runtimes touched the same lines.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.