Adds a helpful message for users trying to run parallel without the plugin

This commit is contained in:
luke
2021-08-13 10:44:11 +01:00
parent 2887d212e3
commit c6435d5606

View File

@ -5,6 +5,7 @@ use NunoMaduro\Collision\Provider;
use Pest\Actions\ValidatesEnvironment; use Pest\Actions\ValidatesEnvironment;
use Pest\Support\Container; use Pest\Support\Container;
use Pest\TestSuite; use Pest\TestSuite;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -52,9 +53,11 @@ use Symfony\Component\Console\Output\OutputInterface;
} }
} }
$command = $argv->hasParameterOption(['--parallel', '-P']) if ($runInParallel = $argv->hasParameterOption(['--parallel', '-P']) && !class_exists(\Pest\Parallel\Command::class)) {
? \Pest\Parallel\Command::class $output->writeln("Parallel support requires the Pest Parallel plugin. Run <fg=yellow;options=bold>`composer require --dev pestphp/pest-plugin-parallel`</> first.");
: \Pest\Console\Command::class; exit(Command::FAILURE);
}
$command = $runInParallel ? \Pest\Parallel\Command::class : \Pest\Console\Command::class;
exit($container->get($command)->run($args)); exit($container->get($command)->run($args));
})(); })();