@@ -167,9 +167,7 @@ dev_dependencies:
167167 workingDirectory: pkgDir,
168168 );
169169 await validateTest (test);
170- expect (
171- File (lcovFile).readAsStringSync (),
172- contains ('''
170+ expect (File (lcovFile).readAsStringSync (), '''
173171SF:${p .join (pkgDir , 'lib' , 'calculate.dart' )}
174172DA:1,1
175173DA:2,2
@@ -178,8 +176,7 @@ DA:5,0
178176LF:4
179177LH:3
180178end_of_record
181- ''' ),
182- );
179+ ''' );
183180 });
184181
185182 test ('gathers coverage for tests in multiple packages' , () async {
@@ -274,9 +271,7 @@ dev_dependencies:
274271 workingDirectory: pkgDir,
275272 );
276273 await validateTest (test);
277- expect (
278- File (lcovFile).readAsStringSync (),
279- contains ('''
274+ expect (File (lcovFile).readAsStringSync (), '''
280275SF:${p .join (pkgDir , 'lib' , 'calculate.dart' )}
281276DA:1,1
282277DA:2,2
@@ -285,11 +280,10 @@ DA:5,0
285280LF:4
286281LH:3
287282end_of_record
288- ''' ),
289- );
283+ ''' );
290284 });
291285
292- test ('gathers coverage for code outside of lib (dart_frog) ' , () async {
286+ test ('gathers coverage for code outside of lib in json mode ' , () async {
293287 await d.dir (d.sandbox, [
294288 d.dir ('dart_frog_sample' , [
295289 d.file ('pubspec.yaml' , '''
@@ -343,14 +337,28 @@ void main() {
343337 ]).create ();
344338
345339 final pkgDir = p.join (d.sandbox, 'dart_frog_sample' );
340+ await (await runPub ([
341+ 'global' ,
342+ 'activate' ,
343+ 'coverage' ,
344+ ], workingDirectory: pkgDir)).shouldExit (0 );
346345 await (await runPub (['get' ], workingDirectory: pkgDir)).shouldExit (0 );
347346 final lcovFile = p.join (coverageDirectory.path, 'lcov.info' );
348347 var test = await runTest (
349- ['--coverage-path ' , lcovFile , 'test/routes/index_test.dart' ],
348+ ['--coverage' , coverageDirectory.path , 'test/routes/index_test.dart' ],
350349 packageConfig: p.join (pkgDir, '.dart_tool/package_config.json' ),
351350 workingDirectory: pkgDir,
352351 );
353352 await validateTest (test);
353+ await (await runPub ([
354+ 'global' ,
355+ 'run' ,
356+ 'coverage:format_coverage' ,
357+ '--lcov' ,
358+ '--in=${coverageDirectory .path }' ,
359+ '--out=$lcovFile ' ,
360+ '--report-on=lib,routes' ,
361+ ], workingDirectory: pkgDir)).shouldExit (0 );
354362 expect (
355363 File (lcovFile).readAsStringSync (),
356364 contains ('''
0 commit comments