feat: improves feedback when test misses description

This commit is contained in:
Nuno Maduro
2022-11-09 20:31:35 +00:00
parent f6cfd425c6
commit 348bd4b923
2 changed files with 26 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use ParseError;
use Pest\Concerns;
use Pest\Contracts\HasPrintableTestCaseName;
use Pest\Exceptions\DatasetMissing;
use Pest\Exceptions\TestDescriptionMissing;
use Pest\Exceptions\ShouldNotHappen;
use Pest\Exceptions\TestAlreadyExist;
use Pest\Factories\Concerns\HigherOrderable;
@ -224,7 +225,7 @@ final class TestCaseFactory
public function addMethod(TestCaseMethodFactory $method): void
{
if ($method->description === null) {
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
throw new TestDescriptionMissing($method->filename);
}
if (array_key_exists($method->description, $this->methods)) {