Unverified Commit d2ba83d4 authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Use libraryFilters flag to speed up coverage collection (#104122)

* Use libraryFilters flag to speed up coverage collection

* Allow libraryNames to be null

* Unconditionally enable the reportLines flag

* Fix analysis errors
parent d9f3acb1
......@@ -112,16 +112,13 @@ Future<void> run(List<String> args) async {
Directory testDirectory;
CoverageCollector collector;
if (argResults['coverage'] as bool) {
// If we have a specified coverage directory then accept all libraries by
// setting libraryNames to null.
final Set<String> libraryNames = coverageDirectory != null ? null :
<String>{FlutterProject.current().manifest.appName};
collector = CoverageCollector(
packagesPath: globals.fs.path.normalize(globals.fs.path.absolute(argResults[_kOptionPackages] as String)),
libraryPredicate: (String libraryName) {
// If we have a specified coverage directory then accept all libraries.
if (coverageDirectory != null) {
return true;
}
final String projectName = FlutterProject.current().manifest.appName;
return libraryName.contains(projectName);
});
libraryNames: libraryNames);
if (!argResults.options.contains(_kOptionTestDirectory)) {
throwToolExit('Use of --coverage requires setting --test-directory');
}
......
......@@ -380,7 +380,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
final String projectName = flutterProject.manifest.appName;
collector = CoverageCollector(
verbose: !machine,
libraryPredicate: (String libraryName) => libraryName.contains(projectName),
libraryNames: <String>{projectName},
packagesPath: buildInfo.packagesPath
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment