[flutter_tool] fix incorrect coverage file generation (#71726)
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ class CoverageCollector extends TestWatcher {
|
||||
Future<String> finalizeCoverage({
|
||||
coverage.Formatter formatter,
|
||||
Directory coverageDirectory,
|
||||
String packagesPath,
|
||||
}) async {
|
||||
if (_globalHitmap == null) {
|
||||
return null;
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user