mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
feat: rewrites --dirty support
This commit is contained in:
20
bin/pest
20
bin/pest
@ -3,10 +3,9 @@
|
||||
|
||||
use Pest\Actions\ValidatesEnvironment;
|
||||
use Pest\ConfigLoader;
|
||||
use Pest\Repositories\TestRepository;
|
||||
use Pest\Support\Container;
|
||||
use Pest\Kernel;
|
||||
use Pest\Support\DirtyTestCaseFilter;
|
||||
use Pest\Support\Container;
|
||||
use Pest\TestCaseFilters\GitDirtyTestCaseFilter;
|
||||
use Pest\TestSuite;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
@ -46,20 +45,17 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
$rootPath = dirname($autoloadPath, 2);
|
||||
$argv = new ArgvInput();
|
||||
|
||||
$filters = [];
|
||||
|
||||
foreach ($args as $key => $value) {
|
||||
if (str_contains($value, '--dirty')) {
|
||||
$filters[] = new DirtyTestCaseFilter($rootPath);
|
||||
}
|
||||
}
|
||||
|
||||
$testSuite = TestSuite::getInstance(
|
||||
$rootPath,
|
||||
$argv->getParameterOption('--test-directory', (new ConfigLoader($rootPath))->getTestsDirectory()),
|
||||
new TestRepository($filters),
|
||||
);
|
||||
|
||||
foreach ($args as $key => $value) {
|
||||
if (str_contains($value, '--dirty')) {
|
||||
$testSuite->tests->filter(new GitDirtyTestCaseFilter($rootPath));
|
||||
}
|
||||
}
|
||||
|
||||
$isDecorated = $argv->getParameterOption('--colors', 'always') !== 'never';
|
||||
|
||||
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated);
|
||||
|
||||
Reference in New Issue
Block a user