fix: ensures --retry works with errored tests

This commit is contained in:
Nuno Maduro
2023-01-02 20:59:59 +00:00
parent 43a7df2cc1
commit 330b4f0171
7 changed files with 44 additions and 14 deletions

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Pest\Subscribers;
use Pest\TestSuite;
use PHPUnit\Event\Test\Errored;
use PHPUnit\Event\Test\ErroredSubscriber;
/**
* @internal
*/
final class EnsureErroredTestsAreRetryable implements ErroredSubscriber
{
/**
* Runs the subscriber.
*/
public function notify(Errored $event): void
{
TestSuite::getInstance()->retryRepository->add($event->test()->id());
}
}

View File

@ -11,13 +11,13 @@ use PHPUnit\Event\Test\FailedSubscriber;
/**
* @internal
*/
final class EnsureFailedTestsAreStoredForRetry implements FailedSubscriber
final class EnsureFailedTestsAreRetryable implements FailedSubscriber
{
/**
* Runs the subscriber.
*/
public function notify(Failed $event): void
{
TestSuite::getInstance()->retryTempRepository->add($event->test()->id());
TestSuite::getInstance()->retryRepository->add($event->test()->id());
}
}

View File

@ -18,6 +18,6 @@ final class EnsureRetryRepositoryExists implements StartedSubscriber
*/
public function notify(Started $event): void
{
TestSuite::getInstance()->retryTempRepository->boot();
TestSuite::getInstance()->retryRepository->boot();
}
}