Today at work I implemented Parallel Testing to one of our projects. Perfect timing as we also just recently upgraded to Laravel 8 (coming from Laravel 7).
I was certain that Parallel Testing is available in Laravel 8 as I followed the development of this feature since the beginning of this year. However, after installing
brianium/paratest package to our app and running the command
php artisan test --parallel I encountered this error:
This got me confused, so I checked the Laravel 8 documentation for Parallel Testing and it was there.
However, this doesn't solve the issue as nothing in the documentation mentions this error.
So I decided to dig a bit further. And as it turns out, Parallel Testing was originally created for Laravel 9 and then backported to Laravel 8. Due to this, earlier versions of
nunomaduro/collision package (5.0, 5.1, 5.2 - which what I was using at the time) had a restriction to only use
--parallel option on Laravel 9, but version 5.3 removed that restriction.
This link shows comparison of collison version 5.2 to 5.3. Checkout line 74 of
src/Adapters/Laravel/Commands/TestCommand.php file for the removal of restriction.
So I promptly updated
^5.3 on my project and fixed the issue.
While at it I also took the liberty of creating a pull request to laravel documentation so that this issue is properly documented and other developers don't waste their time in the future.