Files
pest/tests/Unit/Plugins/Tia/Recorder.php
T
nuno maduro 81eacd79fd 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>
2026-07-18 02:50:20 +01:00

62 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
use Pest\Plugins\Tia\Recorder;
describe('activateLinkTracking()', function (): void {
it('tracks tables without a coverage driver', function (): void {
$recorder = new Recorder;
$recorder->activateLinkTracking();
$recorder->beginTest('Some\Missing\TestClass', 'it does things', '/project/tests/Feature/OrderTest.php');
$recorder->linkTable('orders');
$recorder->linkTable('users');
$recorder->endTest();
expect($recorder->perTestTables())
->toBe(['/project/tests/Feature/OrderTest.php' => ['orders', 'users']]);
});
it('tracks inertia components without a coverage driver', function (): void {
$recorder = new Recorder;
$recorder->activateLinkTracking();
$recorder->beginTest('Some\Missing\TestClass', 'it renders', '/project/tests/Feature/DashboardTest.php');
$recorder->linkInertiaComponent('Dashboard/Index');
$recorder->endTest();
expect($recorder->perTestInertiaComponents())
->toBe(['/project/tests/Feature/DashboardTest.php' => ['Dashboard/Index']]);
});
it('tracks linked sources across consecutive tests', function (): void {
$recorder = new Recorder;
$recorder->activateLinkTracking();
$recorder->beginTest('Some\Missing\TestClass', 'first', '/project/tests/Feature/FirstTest.php');
$recorder->linkSource('/project/resources/views/welcome.blade.php');
$recorder->endTest();
// A second test must start cleanly — endTest resets state even with no driver.
$recorder->beginTest('Some\Missing\TestClass', 'second', '/project/tests/Feature/SecondTest.php');
$recorder->linkSource('/project/resources/views/about.blade.php');
$recorder->endTest();
expect($recorder->perTestFiles())->toBe([
'/project/tests/Feature/FirstTest.php' => ['/project/resources/views/welcome.blade.php'],
'/project/tests/Feature/SecondTest.php' => ['/project/resources/views/about.blade.php'],
]);
});
it('records nothing while inactive', function (): void {
$recorder = new Recorder;
$recorder->beginTest('Some\Missing\TestClass', 'it does things', '/project/tests/Feature/OrderTest.php');
$recorder->linkTable('orders');
$recorder->endTest();
expect($recorder->perTestTables())->toBeEmpty();
});
});