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\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.
@ -35,8 +39,10 @@ final class Parallel implements HandlesArguments
public static function isEnabled(): bool
{
$argv = new ArgvInput();
return $argv->hasParameterOption('--parallel') || $argv->hasParameterOption('-p');
if ($argv->hasParameterOption('--parallel')) {
return true;
}
return $argv->hasParameterOption('-p');
}
/**
@ -156,10 +162,9 @@ final class Parallel implements HandlesArguments
*/
private function hasArgumentsThatWouldBeFasterWithoutParallel(): bool
{
$unsupportedArguments = ['--todo', '--retry'];
$arguments = new ArgvInput();
foreach ($unsupportedArguments as $unsupportedArgument) {
foreach (self::UNSUPPORTED_ARGUMENTS as $unsupportedArgument) {
if ($arguments->hasParameterOption($unsupportedArgument)) {
return true;
}

View File

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