Parallel Plugin
Overview
By default, Pest executes your tests sequentially within a single process. However, you may save a lot of time by using the Parallel plugin, which allows you to run tests simultaneously across multiple processes.
Source code: github.com/pestphp/pest-plugin-parallel
Installation
Install the Parallel Plugin via the Composer package manager:
1composer require pestphp/pest-plugin-parallel --dev --with-all-dependencies
Usage
Once installed, running your tests in parallel is as simple as using the --parallel
or -p
option with the standard pest command:
1./vendor/bin/pest --parallel2 3# Shorthand...4./vendor/bin/pest -p
By default, the Parallel plugin will consume as many processes as you have CPU cores on your computer. You can
always tweak this manually with the --processes
option:
1# Use 8 processes to run the test suite2./vendor/bin/pest --parallel --processes=8
The parallel plugin has been fine-tuned to work seamlessly with other Pest options. For example, displaying test coverage is identical to running Pest normally:
1./vendor/bin/pest --parallel --coverage --min=90
Laravel
Note: For a seamless experience, make sure you're running Laravel 8.55.0 or higher.
If you're used to running your Laravel test suite with php artisan test --parallel
, you don't need to
do anything else. Pest is intelligent enough to detect that you want to run your Pest tests instead of
PHPUnit tests.
Next section: Mock Plugin →