fix: updating snapshots in --parallel

This commit is contained in:
nuno maduro
2026-04-15 07:22:10 -07:00
parent 4e03cd3edb
commit 0dd1aa72ef
2 changed files with 7 additions and 6 deletions

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Pest\Plugins;
use Pest\Contracts\Plugins\HandlesArguments;
use Pest\Exceptions\InvalidOption;
use Pest\TestSuite;
/**
@ -20,12 +19,12 @@ final class Snapshot implements HandlesArguments
*/
public function handleArguments(array $arguments): array
{
if (! $this->hasArgument('--update-snapshots', $arguments)) {
if (Parallel::isWorker()) {
return $arguments;
}
if ($this->hasArgument('--parallel', $arguments)) {
throw new InvalidOption('The [--update-snapshots] option is not supported when running in parallel.');
if (! $this->hasArgument('--update-snapshots', $arguments)) {
return $arguments;
}
TestSuite::getInstance()->snapshots->flush();