[flutter_tool] fix incorrect coverage file generation (#71726)

This commit is contained in:
Jonah Williams
2020-12-04 11:15:11 -08:00
committed by GitHub
parent e5f2236aba
commit afb6b95593
3 changed files with 6 additions and 3 deletions

View File

@@ -251,7 +251,8 @@ class TestCommand extends FlutterCommand {
verbose: !machine,
libraryPredicate: (String libraryName) => libraryName.contains(projectName),
// TODO(jonahwilliams): file bug for incorrect URI handling on windows
packagesPath: globals.fs.path.absolute('.packages'),
packagesPath: globals.fs.file(buildInfo.packagesPath)
.parent.parent.childFile('.packages').path
);
}

View File

@@ -117,7 +117,6 @@ class CoverageCollector extends TestWatcher {
Future<String> finalizeCoverage({
coverage.Formatter formatter,
Directory coverageDirectory,
String packagesPath,
}) async {
if (_globalHitmap == null) {
return null;

View File

@@ -29,6 +29,9 @@ void main() {
await flutter.test(coverage: true);
await flutter.done;
expect(tempDir.childDirectory('coverage').childFile('lcov.info'), exists);
final File lcovFile = tempDir.childDirectory('coverage').childFile('lcov.info');
expect(lcovFile, exists);
expect(lcovFile.readAsStringSync(), contains('main.dart')); // either 'SF:lib/main.dart or SF:lib\\main.dart
});
}