Coverage
Parity has two coverage workflows:
parity checkreads coverage output generated by your existing tools.parity testruns each belonging test individually and normalizes its single-test artifact when the original report cannot identify which test covered each line.
Preferred Format
Use formats with per-line and per-test attribution whenever available. parity-coverage.json is language-neutral. For PHP, PHPUnit XML directories generated with --coverage-xml provide the detail needed for matched coverage and attribution checks.
{
"version": 1,
"globalPercent": 80,
"files": [
{
"path": "src/Foo.ts",
"coveragePercent": 70,
"totalExecutableLines": 10,
"lines": [
{
"line": 1,
"coveredBy": ["FooTest::coversPrimaryBehavior"]
}
]
}
]
}Multiple Coverage Files
coverage_xml can be a single path or an ordered list. Parity uses the first existing path, which lets a project prefer detailed attribution locally and fall back to portable coverage in CI.
coverage_xml: [.parity/per-test, parity-coverage.json, coverage-xml, clover.xml, cobertura.xml]Recommended order:
| Format | Use when | Supports matched coverage |
|---|---|---|
| Parity JSON | A converter or runner plugin can provide test names per line | Yes |
| PHPUnit XML directory | PHPUnit or Pest can generate --coverage-xml | Yes |
| Clover XML | PHP, Jest, Mocha/NYC, Vitest, or other tools emit Clover | No |
| Cobertura XML | Rust, Python, Go, JVM, JS/TS, or CI tools emit Cobertura | No |
Portable Format
Clover XML and Cobertura XML work across many ecosystems and support per-file coverage thresholds. They do not include enough detail to prove which test covered which line.
See Parity Coverage JSON for the full language-neutral attribution schema and converter example.
Generate Attribution With parity test
Configure the command used to run one expected test and the artifact it produces:
test:
command: "./vendor/bin/pest {test_abs} --coverage-clover={coverage}"
coverage: ".parity/tmp/{slug}.xml"
reports: ".parity/per-test"
timeout: 300
coverage_xml: [.parity/per-test, parity-coverage.json, coverage-xml, clover.xml, cobertura.xml]parity test discovers the belonging tests from the same structures and file maps used by parity check. It runs them one at a time, writes .parity/per-test/index.json plus one normalized JSON report per test, and checks those reports automatically. Because each aggregate artifact came from only one test, Parity can safely attribute its covered lines to that test.
Generation happens in a staging directory. A failed, timed-out, or coverage-empty run leaves the previous complete report set untouched.

