Coverage

Requires XDEBUG 2.0+, or PCOV, or PHPDBG.

Code coverage in Pest tells you which lines of code your test suite execute and which lines it doesn’t. Of course, PHPUnit offers you a beautiful section about this topic: Code Coverage Analysis.

Now, in this section, we are going to see the extra options that Pest offers.

--coverage

The --coverage option, gives you a human readable code coverage directly on the console.

./vendor/bin/pest --coverage

Coverage

Keep in mind: the percentage displayed concerns the number of lines of source code that has been tested/executed.

--min

Of course, you can always combine the --coverage option with the --min option to configure minimum threshold enforcement for coverage results. If the thresholds are not met, Pest will return failure.

./vendor/bin/pest --coverage --min=90

Coverage Min

Next section: PHPUnit →