This commit is contained in:
nuno maduro
2026-05-02 00:52:57 +01:00
parent c4911d046b
commit 3cc9b169e3
2 changed files with 153 additions and 88 deletions

View File

@ -249,7 +249,8 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
$alwaysEnabled = $watchPatterns->isEnabled()
&& (! $watchPatterns->isLocally() || Environment::name() === Environment::LOCAL);
$enabled = $cliEnabled || $alwaysEnabled;
$this->filteredMode = $this->hasArgument(self::FILTERED_OPTION, $arguments) || $watchPatterns->isFiltered();
$this->filteredMode = ($this->hasArgument(self::FILTERED_OPTION, $arguments) || $watchPatterns->isFiltered())
&& ! $this->hasExplicitPathArgument($arguments);
$freshRequested = $this->hasArgument(self::FRESH_OPTION, $arguments);
$this->forceRefetch = $this->hasArgument(self::REFETCH_OPTION, $arguments);
@ -1377,6 +1378,32 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
return $coverage->coverage === true;
}
/**
* @param array<int, string> $arguments
*/
private function hasExplicitPathArgument(array $arguments): bool
{
$projectRoot = TestSuite::getInstance()->rootPath;
foreach ($arguments as $arg) {
if ($arg === '' || str_starts_with($arg, '-')) {
continue;
}
if (is_file($arg) || is_dir($arg)) {
return true;
}
$absolute = rtrim($projectRoot, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.ltrim($arg, DIRECTORY_SEPARATOR);
if (is_file($absolute) || is_dir($absolute)) {
return true;
}
}
return false;
}
/**
* @param array<int, string> $changedFiles
*/