# Merge coverage reports from shards: Vitest, Jest and coverage.py > Merge coverage reports from sharded or parallel test runs: Vitest blob reports, Jest with nyc merge, coverage combine in Python, and why merges come out empty. Web page: https://supercov.com/blog/merge-coverage-reports · Published 2026-11-27 All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt Each way to combine shard coverage in Vitest, Jest and coverage.py, measured, including the ones that lose a shard without an error. Run each shard with its own output, then merge the raw data, not the summaries. In Vitest, write blob reports and run `vitest --merge-reports --coverage`. In Jest, put each shard's `coverage-final.json` in one folder, then run `nyc merge` and `nyc report`. In Python, run `coverage combine` with a `[paths]` mapping. ![A diagram of three runners. Vitest shards with --reporter=blob write .vitest/blob JSON files that vitest --merge-reports --coverage turns into one report. Jest shards with --coverageDirectory write coverage-final.json files that nyc merge and nyc report combine. coverage.py with parallel = true writes .coverage files that coverage combine merges.](https://supercov.com/assets/merge-coverage-reports-flow-1360.09d098b71b.webp) *Shards to one report: merge the per-line data, not summaries.* ## Merge commands at a glance | Runner | Each shard | Then | | --- | --- | --- | | Vitest | `vitest run --coverage --reporter=blob --shard=1/2` | `vitest --merge-reports --coverage` | | Jest | `jest --coverage --shard=1/2 --coverageDirectory=coverage/shard-1` | Copy `coverage-final.json` files into one folder, `nyc merge`, `nyc report` | | coverage.py | `coverage run` with `parallel = true`, or rename `.coverage` per job | `coverage combine`, with `[tool.coverage.paths]` | We measured each with two shards of a small project, one testing `pricing` and one testing `shipping`: Vitest 5.1.0 with the V8 provider, Jest 30.5.2 with nyc 18, and coverage.py 7.17.2 with pytest-cov 7.1.0. Each correct merge matched a single run of all the tests. ![A grid of eight merge attempts against two shards, pricing and shipping. Vitest blob with merge-reports: both, 5/6 lines. Vitest without blob: shipping only, 2/6. Vitest blob without coverage: empty. Jest nyc merge from one folder: both, 7/8. Jest default coverage folder: pricing only, 4/8. Jest nyc merge on subfolders: empty. Python combine with path mapping: both, 83%. Python two runs without parallel: shipping only, 33%.](https://supercov.com/assets/merge-coverage-reports-grid-1360.b6a672e938.webp) *Which shard's coverage survived each merge attempt.* ## Vitest: blob reports and --merge-reports ```sh vitest run --coverage --reporter=blob --shard=1/2 vitest run --coverage --reporter=blob --shard=2/2 vitest --merge-reports --coverage ``` Each shard writes `.vitest/blob/blob-1-2.json` and `blob-2-2.json`. The merge reported 5 of 6 lines, the same as one full run. In CI, upload `.vitest/blob` from every job and download them all into that folder before merging. | What we tried | What happened | | --- | --- | | Two shards with `--coverage`, no blob | `coverage/` held only the last shard: 2 of 6 lines | | Blob shards without `--coverage` | Merge wrote an empty report, and exited 0 | | `--merge-reports` without `--coverage` | No merged coverage; `coverage/` still held shard 2 | | Both shards writing `--outputFile=.vitest/blob/blob-1.json` | One overwrote the other: 2 of 6 lines | ## Jest: nyc merge Jest has no merge command. Write each shard's coverage to its own folder, then merge the `coverage-final.json` files with nyc: ```sh jest --coverage --shard=1/2 --coverageDirectory=coverage/shard-1 jest --coverage --shard=2/2 --coverageDirectory=coverage/shard-2 mkdir -p shards merged cp coverage/shard-1/coverage-final.json shards/shard-1.json cp coverage/shard-2/coverage-final.json shards/shard-2.json nyc merge shards merged/coverage-final.json nyc report --temp-dir merged --reporter=lcov --reporter=text ``` This reported 7 of 8 lines, the same as one run. Copying the files straight into `.nyc_output` and running `nyc report` worked too. | What we tried | What happened | | --- | --- | | Two shards in the default `coverage/` | The second overwrote the first: 4 of 8 lines | | `nyc merge coverage` with the shard files in subfolders | Exit 0, empty report: it reads only the top folder | | Both files copied under one name | One shard lost: 4 of 8 lines | | `nyc merge` on `coverage-summary.json` files | "Invalid file coverage object", exit 1 | Keep `json` in `coverageReporters`: `coverage-final.json` has the per-line counts that a merge needs, and the summary has only totals. ## Python: coverage combine ```toml [tool.coverage.run] source = ["shop"] branch = true parallel = true [tool.coverage.paths] source = ["src/", "*/src/"] ``` With `parallel = true`, each `coverage run` writes its own `.coverage...` file. `coverage combine` merges them into `.coverage` and deletes the inputs; `--keep` leaves them. `coverage report` combined them by itself in 7.17.2. For pytest-cov in separate CI jobs, rename each job's `.coverage` to something like `.coverage.job1`, download them into one folder and run `coverage combine`. | What we tried | What happened | | --- | --- | | Two `coverage run` calls, no `parallel` | The second overwrote `.coverage`: 33% | | The second with `--append` | Combined: 83% | | Two pytest-cov runs in one folder | The second deleted the first's `.coverage.pricing` | | Two checkouts at different paths, no `[paths]` | Each file listed twice, 42% over 16 statements | | `[paths]` pattern `/tmp/ci/*/src/` on macOS | No match: paths were recorded under `/private/tmp` | | `[paths]` with `*/src/`, or `relative_files = true` | Merged: 83% over 8 statements | Use `--cov-append` when several pytest-cov runs share a folder. ## What Supercov adds ```sh npx supercov -- npx jest --shard=1/2 npx supercov -- npx jest --shard=2/2 npx supercov merge npx supercov runs check --min-branches 80 ``` `supercov merge` with no runs named combined the two shard runs on the same source, and refuses runs from a different source or configuration rather than add them up. The merged run keeps which test covered each line, with branches and MC/DC, and `runs check` gates it. See [Jest coverage threshold](https://supercov.com/blog/jest-coverage-threshold.md) for the floors, and [Vitest coverage](https://supercov.com/compare/vitest-coverage.md) for the providers.