This commit is contained in:
Luke Downing
2023-02-10 14:48:42 +00:00
committed by Nuno Maduro
parent 757a98230e
commit b7ec3c59b8
3 changed files with 23 additions and 5 deletions

View File

@ -77,7 +77,7 @@ $bootPest = (static function (): void {
$bootPest();
(new CallsHandleArguments())($phpunitArgv);
$phpunitArgv = (new CallsHandleArguments())($phpunitArgv);
$application = new ApplicationForWrapperWorker(
$phpunitArgv,

View File

@ -29,13 +29,18 @@ final class Parallel implements HandlesArguments
Parallel\Handlers\Laravel::class,
];
public static function isInParallelProcess(): bool
{
return (int) Arr::get($_SERVER, 'PARATEST') === 1;
}
public function handleArguments(array $arguments): array
{
if ($this->argumentsContainParallelFlags($arguments)) {
exit($this->runTestSuiteInParallel($arguments));
}
if ((int) Arr::get($_SERVER, 'PARATEST') === 1) {
if (self::isInParallelProcess()) {
return $this->runSubprocessHandlers($arguments);
}

View File

@ -2,19 +2,32 @@
namespace Pest\Plugins\Parallel\Handlers;
use Pest\Contracts\Plugins\HandlesArguments;
use Pest\Plugins\Concerns\HandleArguments;
use Pest\Plugins\Parallel\Contracts\HandlesSubprocessArguments;
use Pest\TestCaseMethodFilters\TodoTestCaseFilter;
use Pest\TestSuite;
use Pest\Plugins\Retry;
final class Pest implements HandlesSubprocessArguments
final class Pest implements HandlesArguments, HandlesSubprocessArguments
{
use HandleArguments;
public function handleArguments(array $arguments): array
{
if (Retry::$retrying) {
$_ENV['PEST_RETRY'] = '1';
}
return $arguments;
}
public function handleSubprocessArguments(array $arguments): array
{
$_SERVER['PEST_PARALLEL'] = '1';
if (isset($_SERVER['PEST_RETRY'])) {
Retry::$retrying = true;
}
return $arguments;
}
}