mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Adds -P as a parallel shortcut
This commit is contained in:
19
bin/pest
19
bin/pest
@ -2,10 +2,7 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
use NunoMaduro\Collision\Provider;
|
use NunoMaduro\Collision\Provider;
|
||||||
use ParaTest\Console\Commands\ParaTestCommand;
|
|
||||||
use Pest\Actions\InteractsWithPlugins;
|
|
||||||
use Pest\Actions\ValidatesEnvironment;
|
use Pest\Actions\ValidatesEnvironment;
|
||||||
use Pest\Console\Command;
|
|
||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
@ -44,20 +41,20 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
|
|
||||||
ValidatesEnvironment::in($testSuite);
|
ValidatesEnvironment::in($testSuite);
|
||||||
|
|
||||||
|
$args = $_SERVER['argv'];
|
||||||
|
|
||||||
// Let's remove any arguments that PHPUnit does not understand
|
// Let's remove any arguments that PHPUnit does not understand
|
||||||
if ($argv->hasParameterOption('--test-directory')) {
|
if ($argv->hasParameterOption('--test-directory')) {
|
||||||
foreach ($_SERVER['argv'] as $key => $value) {
|
foreach ($args as $key => $value) {
|
||||||
if (strpos($value, '--test-directory') !== false) {
|
if (strpos($value, '--test-directory') !== false) {
|
||||||
unset($_SERVER['argv'][$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SERVER['argv'] = InteractsWithPlugins::handleArguments($_SERVER['argv']);
|
$command = $argv->hasParameterOption(['--parallel', '-P'])
|
||||||
|
? \Pest\Parallel\Command::class
|
||||||
|
: \Pest\Console\Command::class;
|
||||||
|
|
||||||
if ($argv->hasParameterOption('--parallel')) {
|
exit($container->get($command)->run($args));
|
||||||
exit(ParaTestCommand::applicationFactory($testSuite->rootPath)->run(new ArgvInput()));
|
|
||||||
}
|
|
||||||
|
|
||||||
exit($container->get(Command::class)->run($_SERVER['argv']));
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -9,8 +9,6 @@ use Pest\Actions\AddsTests;
|
|||||||
use Pest\Actions\InteractsWithPlugins;
|
use Pest\Actions\InteractsWithPlugins;
|
||||||
use Pest\Actions\LoadStructure;
|
use Pest\Actions\LoadStructure;
|
||||||
use Pest\Actions\ValidatesConfiguration;
|
use Pest\Actions\ValidatesConfiguration;
|
||||||
use Pest\Contracts\Plugins\AddsOutput;
|
|
||||||
use Pest\Plugin\Loader;
|
|
||||||
use Pest\Plugins\Version;
|
use Pest\Plugins\Version;
|
||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
@ -57,6 +55,8 @@ final class Command extends BaseCommand
|
|||||||
*/
|
*/
|
||||||
protected function handleArguments(array $argv): void
|
protected function handleArguments(array $argv): void
|
||||||
{
|
{
|
||||||
|
$argv = InteractsWithPlugins::handleArguments($argv);
|
||||||
|
|
||||||
parent::handleArguments($argv);
|
parent::handleArguments($argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user