@@ -79,22 +79,22 @@ class _CoverageMetrics {
7979 String ? excludeFromCoverage,
8080 ) {
8181 final glob = excludeFromCoverage != null ? Glob (excludeFromCoverage) : null ;
82- return records.fold <_CoverageMetrics >(
83- const _CoverageMetrics ._() ,
84- (current, record) {
85- final found = record.lines ? .found ?? 0 ;
86- final hit = record.lines? .hit ?? 0 ;
87- if (glob != null && record.file != null ) {
88- if (glob. matches ( record.file! ) ) {
89- return current;
90- }
82+ return records.fold <_CoverageMetrics >(const _CoverageMetrics ._(), (
83+ current ,
84+ record,
85+ ) {
86+ final found = record.lines? .found ?? 0 ;
87+ final hit = record.lines ? .hit ?? 0 ;
88+ if (glob != null && record.file != null ) {
89+ if (glob. matches (record.file ! )) {
90+ return current;
9191 }
92- return _CoverageMetrics ._(
93- totalFound : current.totalFound + found,
94- totalHits : current.totalHits + hit ,
95- );
96- },
97- );
92+ }
93+ return _CoverageMetrics ._(
94+ totalFound : current.totalFound + found ,
95+ totalHits : current.totalHits + hit,
96+ );
97+ } );
9898 }
9999
100100 final int totalHits;
@@ -105,22 +105,21 @@ class _CoverageMetrics {
105105
106106/// Type definition for the [flutterTest] command
107107/// from 'package:very_good_test_runner`.
108- typedef FlutterTestRunner = Stream <TestEvent > Function ({
109- List <String >? arguments,
110- String ? workingDirectory,
111- Map <String , String >? environment,
112- bool runInShell,
113- });
108+ typedef FlutterTestRunner =
109+ Stream <TestEvent > Function ({
110+ List <String >? arguments,
111+ String ? workingDirectory,
112+ Map <String , String >? environment,
113+ bool runInShell,
114+ });
114115
115116/// A method which returns a [Future<MasonGenerator>] given a [MasonBundle] .
116117typedef GeneratorBuilder = Future <MasonGenerator > Function (MasonBundle );
117118
118119/// Flutter CLI
119120class Flutter {
120121 /// Determine whether flutter is installed.
121- static Future <bool > installed ({
122- required Logger logger,
123- }) async {
122+ static Future <bool > installed ({required Logger logger}) async {
124123 try {
125124 await _Cmd .run ('flutter' , ['--version' ], logger: logger);
126125 return true ;
@@ -210,14 +209,10 @@ class Flutter {
210209 final path =
211210 relativePath == '.' ? '.' : '.${p .context .separator }$relativePath ' ;
212211
213- stdout? .call (
214- 'Running "flutter test" in $path ...\n ' ,
215- );
212+ stdout? .call ('Running "flutter test" in $path ...\n ' );
216213
217214 if (! Directory (p.join (target.dir.absolute.path, 'test' )).existsSync ()) {
218- stdout? .call (
219- 'No test folder found in $path \n ' ,
220- );
215+ stdout? .call ('No test folder found in $path \n ' );
221216 return ExitCode .success.code;
222217 }
223218
@@ -312,22 +307,20 @@ Future<void> _verifyGitDependencies(
312307 final dependencies = pubspec.dependencies;
313308 final devDependencies = pubspec.devDependencies;
314309 final dependencyOverrides = pubspec.dependencyOverrides;
315- final gitDependencies = [
316- ...dependencies.entries,
317- ...devDependencies.entries,
318- ...dependencyOverrides.entries,
319- ]
320- .where ((entry) => entry.value is GitDependency )
321- .map ((entry) => entry.value)
322- .cast <GitDependency >()
323- .toList ();
310+ final gitDependencies =
311+ [
312+ ...dependencies.entries,
313+ ...devDependencies.entries,
314+ ...dependencyOverrides.entries,
315+ ]
316+ .where ((entry) => entry.value is GitDependency )
317+ .map ((entry) => entry.value)
318+ .cast <GitDependency >()
319+ .toList ();
324320
325321 await Future .wait (
326322 gitDependencies.map (
327- (dependency) => Git .reachable (
328- dependency.url,
329- logger: logger,
330- ),
323+ (dependency) => Git .reachable (dependency.url, logger: logger),
331324 ),
332325 );
333326}
@@ -376,7 +369,8 @@ Future<int> _flutterTest({
376369 final groups = < int , TestGroup > {};
377370 final tests = < int , Test > {};
378371 final failedTestErrorMessages = < String , List <String >> {};
379- final sigintWatch = ProcessSignalOverrides .current? .sigintWatch ??
372+ final sigintWatch =
373+ ProcessSignalOverrides .current? .sigintWatch ??
380374 ProcessSignal .sigint.watch ();
381375
382376 var successCount = 0 ;
@@ -395,13 +389,11 @@ Future<int> _flutterTest({
395389 final timerSubscription = Stream .periodic (
396390 const Duration (seconds: 1 ),
397391 (computationCount) => computationCount,
398- ).listen (
399- (tick) {
400- if (completer.isCompleted) return ;
401- final timeElapsed = Duration (seconds: tick).formatted ();
402- stdout ('$clearLine $timeElapsed ...' );
403- },
404- );
392+ ).listen ((tick) {
393+ if (completer.isCompleted) return ;
394+ final timeElapsed = Duration (seconds: tick).formatted ();
395+ stdout ('$clearLine $timeElapsed ...' );
396+ });
405397
406398 late final StreamSubscription <TestEvent > subscription;
407399 late final StreamSubscription <ProcessSignal > sigintWatchSubscription;
@@ -415,10 +407,7 @@ Future<int> _flutterTest({
415407
416408 subscription = testRunner (
417409 workingDirectory: cwd,
418- arguments: [
419- if (collectCoverage) '--coverage' ,
420- ...? arguments,
421- ],
410+ arguments: [if (collectCoverage) '--coverage' , ...? arguments],
422411 runInShell: true ,
423412 ).listen (
424413 (event) {
@@ -506,17 +495,18 @@ Future<int> _flutterTest({
506495 final timeElapsed = Duration (milliseconds: event.time).formatted ();
507496 final stats = computeStats ();
508497 final truncatedTestName = testName.toSingleLine ().truncated (
509- _lineLength - (timeElapsed.length + stats.length + 2 ),
510- );
498+ _lineLength - (timeElapsed.length + stats.length + 2 ),
499+ );
511500 stdout ('''$clearLine $timeElapsed $stats : $truncatedTestName ''' );
512501 }
513502
514503 if (event is DoneTestEvent ) {
515504 final timeElapsed = Duration (milliseconds: event.time).formatted ();
516505 final stats = computeStats ();
517- final summary = event.success ?? false
518- ? lightGreen.wrap ('All tests passed!' )!
519- : lightRed.wrap ('Some tests failed.' )! ;
506+ final summary =
507+ event.success ?? false
508+ ? lightGreen.wrap ('All tests passed!' )!
509+ : lightRed.wrap ('Some tests failed.' )! ;
520510
521511 stdout ('$clearLine ${darkGray .wrap (timeElapsed )} $stats : $summary \n ' );
522512
@@ -570,9 +560,8 @@ String? _topGroupName(Test test, Map<int, TestGroup> groups) => test.groupIDs
570560 .map ((groupID) => groups[groupID]? .name)
571561 .firstWhereOrNull ((groupName) => groupName? .isNotEmpty ?? false );
572562
573- Future <void > _cleanupOptimizerFile (String cwd) async => File (
574- p.join (cwd, 'test' , _testOptimizerFileName),
575- ).delete ().ignore ();
563+ Future <void > _cleanupOptimizerFile (String cwd) async =>
564+ File (p.join (cwd, 'test' , _testOptimizerFileName)).delete ().ignore ();
576565
577566final int _lineLength = () {
578567 try {
0 commit comments