feat: adds --retry option

This commit is contained in:
Nuno Maduro
2021-12-04 21:18:55 +00:00
parent 8047ae570d
commit 106b279ed0
17 changed files with 237 additions and 113 deletions

View File

@ -8,6 +8,7 @@ use Closure;
use Pest\Datasets;
use Pest\Exceptions\ShouldNotHappen;
use Pest\Factories\Concerns\HigherOrderable;
use Pest\Plugins\Retry;
use Pest\Support\Str;
use Pest\TestSuite;
use PHPUnit\Framework\Assert;
@ -107,7 +108,7 @@ final class TestCaseMethodFactory
*
* @param array<int, class-string> $annotationsToUse
*/
public function buildForEvaluation(array $annotationsToUse): string
public function buildForEvaluation(string $classFQN, array $annotationsToUse): string
{
if ($this->description === null) {
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
@ -115,6 +116,10 @@ final class TestCaseMethodFactory
$methodName = Str::evaluable($this->description);
if (Retry::$retrying && !TestSuite::getInstance()->retryTempRepository->exists(sprintf('%s::%s', $classFQN, $methodName))) {
return '';
}
$datasetsCode = '';
$annotations = ['@test'];