This commit is contained in:
nuno maduro
2026-04-23 09:44:12 -07:00
parent e876dba8ba
commit c1feefbb9e
4 changed files with 146 additions and 2 deletions

View File

@ -153,11 +153,25 @@ final class Graph
}
}
// 2. Watch-pattern lookup (non-PHP assets → test directories).
// 2. Watch-pattern lookup — fallback for files we don't have
// precise edges for. When a file is already in `$fileIds` step
// 1 resolved it surgically; broadcasting it again through the
// watch pattern would re-add every test the pattern maps to,
// defeating the point of recording the edge in the first place.
// Blade templates captured via Laravel's view composer are the
// motivating case — we want their specific tests, not every
// feature test.
$unknownToGraph = [];
foreach ($normalised as $rel) {
if (! isset($this->fileIds[$rel])) {
$unknownToGraph[] = $rel;
}
}
/** @var WatchPatterns $watchPatterns */
$watchPatterns = Container::getInstance()->get(WatchPatterns::class);
$dirs = $watchPatterns->matchedDirectories($this->projectRoot, $normalised);
$dirs = $watchPatterns->matchedDirectories($this->projectRoot, $unknownToGraph);
$allTestFiles = array_keys($this->edges);
foreach ($watchPatterns->testsUnderDirectories($dirs, $allTestFiles) as $testFile) {