fix(tia): list the whole suite with --list-tests (#1973)

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
This commit is contained in:
Lazizbek Ergashev
2026-11-13 17:51:51 +05:00
committed by GitHub
parent cf20587575
commit 4765bdb8d0
2 changed files with 29 additions and 1 deletions
+15 -1
View File
@@ -141,6 +141,12 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
'--assignee', '--issue', '--ticket', '--pr', '--pull-request',
];
/** @var list<string> */
private const array LISTING_FLAGS = [
'--list-groups', '--list-suites', '--list-tests', '--list-tests-xml',
'--list-test-files', '--list-test-ids',
];
private const array UNSUPPORTED_OPTIONS = [
'--covers', '--uses', '--random-order-seed',
];
@@ -494,7 +500,7 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
$hasExplicitPath = $this->hasExplicitPathArgument($arguments);
$partial = ! $isWorker && ($hasExplicitPath || $this->hasPartialSelection($arguments));
$disabled = $disabled || $partial;
$disabled = $disabled || $partial || $this->hasListingOption($arguments);
$mutating = self::isMutationRun($this->originalArguments);
@@ -1987,6 +1993,14 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
return false;
}
/**
* @param array<int, string> $arguments
*/
private function hasListingOption(array $arguments): bool
{
return array_any(self::LISTING_FLAGS, fn (string $flag): bool => $this->hasArgument($flag, $arguments));
}
private function stoppedEarly(): bool
{
return TestResultFacade::shouldStop();
+14
View File
@@ -36,6 +36,20 @@ test('an explicit path turns filtered mode off', function (): void {
->and($delta->isResultsOnly())->toBeTrue($delta->summary());
})->skipOnWindows();
test('--list-tests lists the whole suite in filtered mode', function (): void {
$project = Project::make('master');
$project->seed('master');
$project->snapshot();
$result = $project->pest('--tia', '--filtered', '--list-tests');
$delta = $project->delta();
expect($result->exitCode)->toBe(0, $result->describe())
->and(substr_count($result->output, ' - '))->toBe(Project::TOTAL_TESTS, $result->describe())
->and($result->output)->not->toContain('No affected tests found')
->and($delta->writtenCount())->toBe(0, $delta->summary());
})->skipOnWindows();
test('filtered mode runs the whole suite when there is no baseline', function (): void {
$project = Project::make('master');