mirror of
https://github.com/pestphp/pest.git
synced 2026-07-24 10:30:03 +02:00
fix: tia engine correctness issues
- keep table/Inertia/database link-tracking alive in piggyback-coverage recording, and merge link-only edges into the piggybacked edge set - route migration changes through the watch-pattern fallback when the graph has no recorded table usage - re-run cached failures whose test file cannot be located, downgrading filtered runs to full replay instead of silently skipping them - align non-filtered replay with the failOn*/displayDetailsOn* rerun policy - resolve anonymous index Blade components (<x-card> from card/index.blade.php) and stop swallowing components whose static usage walk selected no tests - parse CTE/REPLACE queries and schema-qualified identifiers in TableExtractor - scope-filter the xdebug recording path like pcov - ignore in-flight .tmp files in FileState::keysWithPrefix and delete unreadable worker partials - vite deps helper: resolve rolldown through rolldown-vite installs and degrade gracefully, honour vite.config resolve.alias (incl. the laravel-vite-plugin '@' default), resolve .vue/.svelte/.mts/.cts extensions, and stop memoizing cycle-tainted transitive sets Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+38
-2
@@ -296,7 +296,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
$result = $this->replayGraph->getResult($this->branch, $testId);
|
||||
|
||||
if ($result instanceof TestStatus) {
|
||||
if ($result->isFailure() || $result->isError()) {
|
||||
if ($this->replayGraph->shouldRerunStatus($result)) {
|
||||
$this->executedCount++;
|
||||
|
||||
return null;
|
||||
@@ -402,7 +402,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
|
||||
$projectRoot = TestSuite::getInstance()->rootPath;
|
||||
$perTest = $this->piggybackCoverage
|
||||
? $this->coverageCollector->perTestFiles()
|
||||
? $this->mergePerTestFiles($this->coverageCollector->perTestFiles(), $recorder->perTestFiles())
|
||||
: $recorder->perTestFiles();
|
||||
|
||||
if ($perTest === []) {
|
||||
@@ -715,6 +715,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
}
|
||||
|
||||
if ($this->piggybackCoverage) {
|
||||
$this->recorder->activateLinkTracking();
|
||||
$this->recordingActive = true;
|
||||
|
||||
return $arguments;
|
||||
@@ -782,6 +783,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
private function activateWorkerRecorderForReplay(array $arguments): array
|
||||
{
|
||||
if ($this->piggybackCoverage) {
|
||||
$this->recorder->activateLinkTracking();
|
||||
$this->recordingActive = true;
|
||||
|
||||
return $arguments;
|
||||
@@ -834,6 +836,13 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
$affectedFromChanges = $changed === [] ? [] : $graph->affected($changed);
|
||||
$rerunFromCache = [];
|
||||
|
||||
if ($this->filteredMode && $graph->hasUnlocatedTestsToRerun($this->branch)) {
|
||||
$this->filteredMode = false;
|
||||
|
||||
$this->renderBadge('WARN', 'Some cached tests due a re-run could not be located on disk.');
|
||||
$this->renderChild('Running the full suite with replay instead of a filtered run.');
|
||||
}
|
||||
|
||||
if ($this->filteredMode) {
|
||||
$rerunFromCache = $graph->testFilesToRerun($this->branch);
|
||||
}
|
||||
@@ -1014,6 +1023,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
}
|
||||
|
||||
if ($this->piggybackCoverage) {
|
||||
$recorder->activateLinkTracking();
|
||||
$this->recordingActive = true;
|
||||
|
||||
$this->output->writeln('');
|
||||
@@ -1235,6 +1245,8 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
$data = $this->readPartial($key);
|
||||
|
||||
if ($data === null) {
|
||||
$this->state->delete($key);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1368,6 +1380,26 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
$this->saveGraph($graph);
|
||||
}
|
||||
|
||||
/**
|
||||
* Union of two per-test edge maps — piggybacked line-coverage edges plus
|
||||
* the recorder's link-tracked edges (rendered Blade views, ...), which
|
||||
* never appear in line coverage.
|
||||
*
|
||||
* @param array<string, array<int, string>> $coverage
|
||||
* @param array<string, array<int, string>> $linked
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
private function mergePerTestFiles(array $coverage, array $linked): array
|
||||
{
|
||||
foreach ($linked as $testFile => $sources) {
|
||||
$existing = $coverage[$testFile] ?? [];
|
||||
|
||||
$coverage[$testFile] = array_values(array_unique([...$existing, ...$sources]));
|
||||
}
|
||||
|
||||
return $coverage;
|
||||
}
|
||||
|
||||
private function seedResultsInto(Graph $graph): void
|
||||
{
|
||||
/** @var ResultCollector $collector */
|
||||
@@ -1379,6 +1411,10 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
||||
foreach ($results as $testId => $result) {
|
||||
$file = $result['file'] ?? null;
|
||||
|
||||
if ($file === null || str_contains($file, "eval()'d")) {
|
||||
$file = $this->resolveFailedTestFile($testId);
|
||||
}
|
||||
|
||||
if (is_string($file) && $file !== '') {
|
||||
$touchedFiles[$file] = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user