Coverage: fix installHook API (#10747)
- remove unused collector parameter
- clarify a comment
- inline _currentPackageTestDir
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 6171abc..a26ea29 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -72,12 +72,6 @@
@override
String get description => 'Run Flutter unit tests for the current project.';
- Directory get _currentPackageTestDir {
- // We don't scan the entire package, only the test/ subdirectory, so that
- // files with names like like "hit_test.dart" don't get run.
- return fs.directory('test');
- }
-
Future<bool> _collectCoverageData(CoverageCollector collector, { bool mergeCoverageData: false }) async {
final Status status = logger.startProgress('Collecting coverage information...');
final String coverageData = await collector.finalizeCoverage(
@@ -159,7 +153,9 @@
Directory workDir;
if (files.isEmpty) {
- workDir = _currentPackageTestDir;
+ // We don't scan the entire package, only the test/ subdirectory, so that
+ // files with names like like "hit_test.dart" don't get run.
+ workDir = fs.directory('test');
if (!workDir.existsSync())
throwToolExit('Test directory "${workDir.path}" not found.');
files = _findTests(workDir);
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 8872f79..e3999f3 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -18,7 +18,6 @@
import '../base/process_manager.dart';
import '../dart/package_map.dart';
import '../globals.dart';
-import 'coverage_collector.dart';
import 'watcher.dart';
/// The timeout we give the test process to connect to the test harness
@@ -53,7 +52,6 @@
/// main()`), you can set an observatory port and a diagnostic port explicitly.
void installHook({
@required String shellPath,
- CoverageCollector collector,
TestWatcher watcher,
bool enableObservatory: false,
bool startPaused: false,
diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart
index 7bc9572..80f37e1 100644
--- a/packages/flutter_tools/lib/src/test/runner.dart
+++ b/packages/flutter_tools/lib/src/test/runner.dart
@@ -55,8 +55,8 @@
serverType: serverType,
);
- // Set the package path used for child processes.
- // TODO(skybrian): why is this global? Move to installHook?
+ // Make the global packages path absolute.
+ // (Makes sure it still works after we change the current directory.)
PackageMap.globalPackagesPath =
fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));