Skip to content

Samples ​

Each public sample runs a real test suite in a different ecosystem and proves that Parity catches what global coverage hides. The samples are split into individual repositories so each one installs the public Packagist package during CI and proves the release path without private tokens.

No sample commits coverage results. In CI, every sample runs its native suite, then parity test runs each belonging test file in isolation, normalizes the per-test coverage into .parity/per-test, and checks it.

SampleLanguage/frameworkTest runnerPer-test coverageRepository
PHPPlain PHPPHPUnitClover (Xdebug)php-sample
LaravelLaravel-style PHPPHPUnitClover (Xdebug)laravel-sample
TypeScriptTypeScript utilitynode:test via tsxClover (c8)typescript-sample
AdonisJSAdonisJS 7Japa (node ace test)Clover (c8)adonisjs-sample
RustPlain RustCargo integration testsCobertura (cargo llvm-cov)rust-sample
CargoCargo projectCargo integration testsCobertura (cargo llvm-cov)cargo-sample
PHPUnitPHPPHPUnitClover (Xdebug)phpunit-sample
PestPHPPestClover (Xdebug)pest-sample
JestJavaScriptJestCloverjest-sample
MochaJavaScriptMocha + NYCClovermocha-sample
VitestTypeScriptVitestClovervitest-sample

The Proof ​

Every sample has one weakly owned file and one strongly owned file. In the weak file, the belonging test covers only part of the code, and another test file covers the rest incidentally. Global coverage passes. Parity's matched-coverage rule shows how much the belonging test covers by itself, and coverage-attribution reports 2|1: two tests cover the file, and one of them does not belong to it.

SampleWeakly owned fileAll testsBelonging test onlyProject total
PHPsrc/Calculator.php80%40%85.71%
Laravelapp/Services/InvoiceTotal.php80%40%85.71%
TypeScriptsrc/formatCurrency.ts80%44%81.48%
AdonisJSapp/services/user_presenter.ts84%44%85.19%
Rustsrc/lib.rs80%40%84.21%
Cargosrc/lib.rs80%40%84.21%
PHPUnitcode/src/InvoiceCalculator.php80%40%85.71%
Pestcode/src/Slugger.php80%40%85.71%
Jestcode/src/sum.js85.71%42.86%88.89%
Mochacode/src/greeting.js85.71%42.86%88.89%
Vitestcode/src/formatCurrency.ts100%50%100%

The Vitest sample is the sharpest case: the project has 100% global coverage, but the belonging test still covers only half of formatCurrency.ts.

Each sample README documents its exact source files, tests, and thresholds.

CI Contract ​

Every sample CI installs Parity from Packagist, removes any stale evidence, and generates fresh per-test coverage:

bash
composer global require "testparity/parity:^1.2" --prefer-dist --no-progress --no-interaction
rm -rf -- .parity
parity test --config=parity.yaml --format=json --show-tests

That makes the samples useful as release proof, not just documentation examples.

Bring Your Own Attribution ​

When a runner cannot emit per-test coverage, parity test produces it by running each belonging test file separately. Custom converters can instead write parity-coverage.json, a language-neutral format that records which tests covered each line.