A Pest plugin is available that gives information on the test coverage for Laravel projects.
Xdebug is required to enable text coverage which can be done with the Xdebug setup guide.
How to setup
Run Pest with the coverage flag.
./vendor/bin/pest --coverageWhen I tried I received the following output.
Unable to get coverage using Xdebug. Did you set Xdebug's coverage mode?Go to the php.ini file where xdebug is setup.
sudo nano /etc/php/8.3/cli/php.iniEdit or add the following Xdebug mode line to enable coverage mode with Xdebug.
xdebug.mode=develop,debug,coverageSave the file and try the coverage command again.
./vendor/bin/pest --coverageYou will see the test results and the files checked with the amount of code in those classes that are covered from the current unit tests.