chore(cleanup): Tidy-up and tweaks of Pest Parallel integration.

This commit is contained in:
Luke Downing
2023-02-13 13:11:27 +00:00
parent e22f6e1e4d
commit ec8fb202b3
2 changed files with 10 additions and 7 deletions

View File

@ -28,6 +28,10 @@ final class Parallel implements HandlesArguments
Parallel\Handlers\Pest::class, Parallel\Handlers\Pest::class,
Parallel\Handlers\Laravel::class, Parallel\Handlers\Laravel::class,
]; ];
/**
* @var string[]
*/
private const UNSUPPORTED_ARGUMENTS = ['--todo', '--retry'];
/** /**
* Whether the given command line arguments indicate that the test suite should be run in parallel. * Whether the given command line arguments indicate that the test suite should be run in parallel.
@ -35,8 +39,10 @@ final class Parallel implements HandlesArguments
public static function isEnabled(): bool public static function isEnabled(): bool
{ {
$argv = new ArgvInput(); $argv = new ArgvInput();
if ($argv->hasParameterOption('--parallel')) {
return $argv->hasParameterOption('--parallel') || $argv->hasParameterOption('-p'); return true;
}
return $argv->hasParameterOption('-p');
} }
/** /**
@ -156,10 +162,9 @@ final class Parallel implements HandlesArguments
*/ */
private function hasArgumentsThatWouldBeFasterWithoutParallel(): bool private function hasArgumentsThatWouldBeFasterWithoutParallel(): bool
{ {
$unsupportedArguments = ['--todo', '--retry'];
$arguments = new ArgvInput(); $arguments = new ArgvInput();
foreach ($unsupportedArguments as $unsupportedArgument) { foreach (self::UNSUPPORTED_ARGUMENTS as $unsupportedArgument) {
if ($arguments->hasParameterOption($unsupportedArgument)) { if ($arguments->hasParameterOption($unsupportedArgument)) {
return true; return true;
} }

View File

@ -26,8 +26,6 @@ final class Retry implements HandlesArguments
$arguments = $this->pushArgument('--order-by=defects', $arguments); $arguments = $this->pushArgument('--order-by=defects', $arguments);
$arguments = $this->pushArgument('--stop-on-failure', $arguments); return $this->pushArgument('--stop-on-failure', $arguments);
return $arguments;
} }
} }