@@ -88,6 +88,15 @@ class TestCommand extends Command<bool> with ArgUtils {
8888 '.dart_tool/goldens. Use this option to bulk-update all screenshots, '
8989 'for example, when a new browser version affects pixels.' ,
9090 )
91+ ..addFlag (
92+ 'fetch-goldens-repo' ,
93+ defaultsTo: true ,
94+ negatable: true ,
95+ help:
96+ 'Whether to fetch the goldens repo. Set this to false to iterate '
97+ 'on golden tests without fearing that the fetcher will overwrite '
98+ 'your local changes.' ,
99+ )
91100 ..addOption (
92101 'browser' ,
93102 defaultsTo: 'chrome' ,
@@ -165,39 +174,41 @@ class TestCommand extends Command<bool> with ArgUtils {
165174 final FilePath dir = FilePath .fromWebUi ('' );
166175 print ('' );
167176 print ('Initial test run is done!' );
168- print ('Watching ${dir .relativeToCwd }/lib and ${dir .relativeToCwd }/test to re-run tests' );
177+ print (
178+ 'Watching ${dir .relativeToCwd }/lib and ${dir .relativeToCwd }/test to re-run tests' );
169179 print ('' );
170180 PipelineWatcher (
171- dir: dir.absolute,
172- pipeline: testPipeline,
173- ignore: (event) {
174- // Ignore font files that are copied whenever tests run.
175- if (event.path.endsWith ('.ttf' )) {
176- return true ;
177- }
181+ dir: dir.absolute,
182+ pipeline: testPipeline,
183+ ignore: (event) {
184+ // Ignore font files that are copied whenever tests run.
185+ if (event.path.endsWith ('.ttf' )) {
186+ return true ;
187+ }
178188
179- // Ignore auto-generated JS files.
180- // The reason we are using `.contains()` instead of `.endsWith()` is
181- // because the auto-generated files could end with any of the
182- // following:
183- //
184- // - browser_test.dart.js
185- // - browser_test.dart.js.map
186- // - browser_test.dart.js.deps
187- if (event.path.contains ('browser_test.dart.js' )) {
188- return true ;
189- }
189+ // Ignore auto-generated JS files.
190+ // The reason we are using `.contains()` instead of `.endsWith()` is
191+ // because the auto-generated files could end with any of the
192+ // following:
193+ //
194+ // - browser_test.dart.js
195+ // - browser_test.dart.js.map
196+ // - browser_test.dart.js.deps
197+ if (event.path.contains ('browser_test.dart.js' )) {
198+ return true ;
199+ }
190200
191- // React to changes in lib/ and test/ folders.
192- final String relativePath = path.relative (event.path, from: dir.absolute);
193- if (relativePath.startsWith ('lib/' ) || relativePath.startsWith ('test/' )) {
194- return false ;
195- }
201+ // React to changes in lib/ and test/ folders.
202+ final String relativePath =
203+ path.relative (event.path, from: dir.absolute);
204+ if (relativePath.startsWith ('lib/' ) ||
205+ relativePath.startsWith ('test/' )) {
206+ return false ;
207+ }
196208
197- // Ignore anything else.
198- return true ;
199- }
200- ).start ();
209+ // Ignore anything else.
210+ return true ;
211+ }).start ();
201212 // Return a never-ending future.
202213 return Completer <bool >().future;
203214 } else {
@@ -217,15 +228,17 @@ class TestCommand extends Command<bool> with ArgUtils {
217228 bool unitTestResult = await runUnitTests ();
218229 bool integrationTestResult = await runIntegrationTests ();
219230 if (integrationTestResult != unitTestResult) {
220- print ('Tests run. Integration tests passed: $integrationTestResult '
231+ print (
232+ 'Tests run. Integration tests passed: $integrationTestResult '
221233 'unit tests passed: $unitTestResult ' );
222234 }
223235 return integrationTestResult && unitTestResult;
224236 } else {
225237 return await runUnitTests ();
226238 }
227239 }
228- throw UnimplementedError ('Unknown test type requested: $testTypesRequested ' );
240+ throw UnimplementedError (
241+ 'Unknown test type requested: $testTypesRequested ' );
229242 } on TestFailureException {
230243 return true ;
231244 }
@@ -272,9 +285,9 @@ class TestCommand extends Command<bool> with ArgUtils {
272285 environment.webUiTestResultsDirectory.createSync (recursive: true );
273286
274287 // If screenshot tests are available, fetch the screenshot goldens.
275- if (isScreenshotTestsAvailable) {
288+ if (isScreenshotTestsAvailable && doFetchGoldensRepo ) {
276289 if (isVerboseLoggingEnabled) {
277- print ('INFO: Screenshot tests available ' );
290+ print ('INFO: Fetching goldens repo ' );
278291 }
279292 final GoldensRepoFetcher goldensRepoFetcher = GoldensRepoFetcher (
280293 environment.webUiGoldensRepositoryDirectory,
@@ -483,6 +496,9 @@ class TestCommand extends Command<bool> with ArgUtils {
483496 /// ".dart_tool/goldens".
484497 bool get doUpdateScreenshotGoldens => boolArg ('update-screenshot-goldens' );
485498
499+ /// Whether to fetch the goldens repo prior to running tests.
500+ bool get doFetchGoldensRepo => boolArg ('fetch-goldens-repo' );
501+
486502 /// Runs all tests specified in [targets] .
487503 ///
488504 /// Unlike [_runAllTestsForCurrentPlatform] , this does not filter targets
@@ -774,6 +790,7 @@ const List<String> _kTestFonts = <String>[
774790 'ahem.ttf' ,
775791 'Roboto-Regular.ttf' ,
776792 'NotoNaskhArabic-Regular.ttf' ,
793+ 'NotoColorEmoji.ttf' ,
777794];
778795
779796void _copyTestFontsIntoWebUi () {
0 commit comments