TIA: JS changes in an app without Inertia pages re-run no tests
What Happened
In a Laravel app without Inertia (Livewire or Blade, with a vite.config.js), a change to any JavaScript module under resources/js/ other than the runtime entry files (app.js, bootstrap.js, …) re-runs no tests at all under --tia. Browser tests that load that script are replayed as passing, although Pest's built-in Browser and Livewire watch defaults map resources/js/** to them.
Graph::resolveNewJsFiles() asks the Vite module graph which Inertia pages import the changed file. In an app without pages the resolver succeeds and returns an empty map, and a file with no importing pages is then marked as resolved ($sharedFilesResolved[$rel] = true). applyWatchPatternFallback() skips resolved files, so the watch patterns never see the change. When the resolver is unavailable, the same file does fall back to the watch patterns, so the result depends on whether Node and rolldown happen to be installed.
How to Reproduce
- A Laravel + Livewire app with
vite.config.js, a browser test, and a baseline recorded with--tia. - Change
resources/js/cookie-consent.js(a real code change, not a comment). - Run
vendor/bin/pest --tia: every test is replayed (193 replayed), and no browser test runs.
A change to resources/css/app.css in the same app correctly re-runs every browser test.
Sample Repository
A regression test against the Tia test fixtures accompanies the pull request.
Pest Version
5.2.1 (and 5.x at 8b6607e3)
PHP Version
8.4
Operation System
Linux
Source: pestphp/pest