From c6435d560613e98a1dddb82fecc1da5b9f1d1314 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 13 Aug 2021 10:44:11 +0100 Subject: [PATCH] Adds a helpful message for users trying to run parallel without the plugin --- bin/pest | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/pest b/bin/pest index 254265f8..7e2959ec 100755 --- a/bin/pest +++ b/bin/pest @@ -5,6 +5,7 @@ use NunoMaduro\Collision\Provider; use Pest\Actions\ValidatesEnvironment; use Pest\Support\Container; use Pest\TestSuite; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\OutputInterface; @@ -52,9 +53,11 @@ use Symfony\Component\Console\Output\OutputInterface; } } - $command = $argv->hasParameterOption(['--parallel', '-P']) - ? \Pest\Parallel\Command::class - : \Pest\Console\Command::class; + if ($runInParallel = $argv->hasParameterOption(['--parallel', '-P']) && !class_exists(\Pest\Parallel\Command::class)) { + $output->writeln("Parallel support requires the Pest Parallel plugin. Run `composer require --dev pestphp/pest-plugin-parallel` first."); + exit(Command::FAILURE); + } + $command = $runInParallel ? \Pest\Parallel\Command::class : \Pest\Console\Command::class; exit($container->get($command)->run($args)); })();