dmecke / coverage-checker
Check code coverage per namespace.
Installs: 17 452
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: ^7.3|^8.0
- ext-simplexml: *
- symfony/console: ^4.2|^5.0
- symfony/yaml: ^4.2|^5.0
Requires (Dev)
- phpunit/phpunit: ^9.5
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.