add config loader to read phpunit file and get the tests directory or fallback

This commit is contained in:
danilopolani
2022-03-30 15:39:50 +02:00
parent db5c11d96e
commit 80c411be44
3 changed files with 132 additions and 1 deletions

View File

@ -2,6 +2,7 @@
<?php declare(strict_types=1);
use Pest\Actions\ValidatesEnvironment;
use Pest\ConfigLoader;
use Pest\Support\Container;
use Pest\Kernel;
use Pest\TestSuite;
@ -28,7 +29,9 @@ use Symfony\Component\Console\Output\OutputInterface;
$rootPath = dirname($autoloadPath, 2);
$argv = new ArgvInput();
$testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests'));
$phpunitConfig = new ConfigLoader($rootPath);
$testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', $phpunitConfig->getTestsDirectory()));
$isDecorated = $argv->getParameterOption('--colors', 'always') !== 'never';
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated);