dmecke/coverage-checker

Check code coverage per namespace.

2.1.0 2023-05-07 07:42 UTC

This package is auto-updated.

Last update: 2024-11-07 10:37:17 UTC


README

Install this library by require it via Composer:

composer require --dev dmecke/coverage-checker

Composer will install an executable in its bin-dir which defaults to vendor/bin.

Usage

Add a configuration file called coverage-checker.yaml to your project root:

coverage:
    App: 80
    App\Repository: 50
    App\Domain: 100

Run your test suite with clover coverage enabled:

phpunit --coverage-clover coverage.xml

Run the code coverage check with:

vendor/bin/coverage-checker check coverage.xml

The script will use a return code > 0 if any code coverage does not meet the specified criteria. This way it can be used in CI.

FAQ

Why does the check fail when the coverage is better than defined?

If you managed to improve your test coverage you should increase your defined limits. Otherwise you could fall back to a lower coverage again.