fix: throw a fatal exception if the tests directory does not exist

This commit is contained in:
Joel Butcher
2025-07-29 19:13:33 +01:00
parent f692be3637
commit ee6b3ed062

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Pest\Bootstrappers;
use Pest\Contracts\Bootstrapper;
use Pest\Exceptions\FatalException;
use Pest\Support\DatasetInfo;
use Pest\Support\Str;
use Pest\TestSuite;
@ -40,6 +41,10 @@ final class BootFiles implements Bootstrapper
$rootPath = TestSuite::getInstance()->rootPath;
$testsPath = $rootPath.DIRECTORY_SEPARATOR.testDirectory();
if (! is_dir($testsPath)) {
throw new FatalException(sprintf('The test directory [%s] does not exist.', $testsPath));
}
foreach (self::STRUCTURE as $filename) {
$filename = sprintf('%s%s%s', $testsPath, DIRECTORY_SEPARATOR, $filename);