@@ -45,6 +45,7 @@ void main() {
4545 late ShutdownHooks shutdownHooks;
4646 late List <FlutterWidgetPreviews > detectedChanges;
4747 late List <String > detectedPubspecChanges;
48+ late List <String > detectedNonDartFileChanges;
4849 late LspPreviewDetector detector;
4950
5051 setUp (() async {
@@ -63,6 +64,7 @@ void main() {
6364 shutdownHooks = ShutdownHooks ();
6465 detectedChanges = < FlutterWidgetPreviews > [];
6566 detectedPubspecChanges = < String > [];
67+ detectedNonDartFileChanges = < String > [];
6668
6769 detector = LspPreviewDetector (
6870 platform: platform,
@@ -72,6 +74,7 @@ void main() {
7274 logger: logger,
7375 onChangeDetected: detectedChanges.add,
7476 onPubspecChangeDetected: detectedPubspecChanges.add,
77+ onNonDartFileChangeDetected: detectedNonDartFileChanges.add,
7578 dtd: fakeDtd,
7679 processManager: FakeProcessManager .any (),
7780 terminal: Terminal .test (),
@@ -136,21 +139,20 @@ void main() {
136139 },
137140 );
138141
139- testWithoutContext (
140- 'does not report preview reload timing when non-Dart file is modified' ,
141- () async {
142- expectNPreviewReloadTimingEvents (0 );
143- expect (detectedChanges, isEmpty);
144- expect (detectedPubspecChanges, isEmpty);
142+ testWithoutContext ('notifies onNonDartFileChangeDetected and does not report preview reload timing when non-Dart file is modified' , () async {
143+ expectNPreviewReloadTimingEvents (0 );
144+ expect (detectedChanges, isEmpty);
145+ expect (detectedPubspecChanges, isEmpty);
146+ expect (detectedNonDartFileChanges, isEmpty);
145147
146- await emitEvent (WatchEvent (ChangeType .MODIFY , _kNonDartFilePath));
148+ await emitEvent (WatchEvent (ChangeType .MODIFY , _kNonDartFilePath));
147149
148- expect (detectedChanges, isEmpty);
149- expect (detectedPubspecChanges, isEmpty);
150- expectNPreviewReloadTimingEvents ( 0 );
151- expect (fakeAnalysisServer.waitForAnalysisCallCount, 0 );
152- },
153- );
150+ expect (detectedChanges, isEmpty);
151+ expect (detectedPubspecChanges, isEmpty);
152+ expect (detectedNonDartFileChanges, < String > [_kNonDartFilePath] );
153+ expectNPreviewReloadTimingEvents ( 0 );
154+ expect (fakeAnalysisServer.waitForAnalysisCallCount, 0 );
155+ } );
154156
155157 testWithoutContext ('does not report preview reload timing for ignored directories' , () async {
156158 expectNPreviewReloadTimingEvents (0 );
@@ -159,6 +161,7 @@ void main() {
159161
160162 expect (detectedChanges, isEmpty);
161163 expect (detectedPubspecChanges, isEmpty);
164+ expect (detectedNonDartFileChanges, isEmpty);
162165 expectNPreviewReloadTimingEvents (0 );
163166 expect (fakeAnalysisServer.waitForAnalysisCallCount, 0 );
164167 });
0 commit comments