mirror of
https://github.com/pestphp/pest.git
synced 2026-12-05 07:15:33 +01:00
fix(tia): let JS modules no Inertia page imports fall back to the watch patterns (#1936)
This commit is contained in:
@@ -355,8 +355,6 @@ final class Graph
|
||||
$pages = $freshMap[$rel] ?? [];
|
||||
|
||||
if ($pages === []) {
|
||||
$sharedFilesResolved[$rel] = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Pest\Plugins\Tia\JsModuleGraph;
|
||||
use Tests\Fixtures\Tia\Project;
|
||||
|
||||
afterEach(function (): void {
|
||||
@@ -216,3 +217,23 @@ test('a changed frontend runtime file selects every Inertia test', function ():
|
||||
expect($result->affected())->toBe(2, $result->describe())
|
||||
->and($result->replayed())->toBe(4, $result->describe());
|
||||
})->skipOnWindows();
|
||||
|
||||
test('a changed JS module that no Inertia page imports falls back to the watch patterns', function (): void {
|
||||
$project = Project::make('master', 'js-watch');
|
||||
$project->write('vite.config.js', "export default {}\n");
|
||||
$project->write('resources/js/widget.js', "export const widget = 1\n");
|
||||
$project->git()->commit('add a Vite app without Inertia pages');
|
||||
|
||||
$project->seed('master');
|
||||
|
||||
$fingerprint = new ReflectionMethod(JsModuleGraph::class, 'fingerprint')->invoke(null, $project->path());
|
||||
file_put_contents($project->graphDir().DIRECTORY_SEPARATOR.'js-module-graph.cache.json', json_encode(['fingerprint' => $fingerprint, 'graph' => []]));
|
||||
|
||||
$project->write('resources/js/widget.js', "export const widget = 2\n");
|
||||
$project->snapshot();
|
||||
|
||||
$result = $project->pest('--tia');
|
||||
|
||||
expect($result->affected())->toBe(6, $result->describe())
|
||||
->and($result->replayed())->toBe(0, $result->describe());
|
||||
})->skipOnWindows();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__.'/../app/Calculator.php';
|
||||
require_once __DIR__.'/../app/Greeter.php';
|
||||
|
||||
pest()->tia()->watch(['resources/js/**' => 'tests']);
|
||||
Reference in New Issue
Block a user