Commit d1feb1ad authored by Brian Slesinsky's avatar Brian Slesinsky Committed by GitHub

Coverage: fix installHook API (#10747)

- remove unused collector parameter
- clarify a comment
- inline _currentPackageTestDir
parent 99e343a2
...@@ -72,12 +72,6 @@ class TestCommand extends FlutterCommand { ...@@ -72,12 +72,6 @@ class TestCommand extends FlutterCommand {
@override @override
String get description => 'Run Flutter unit tests for the current project.'; 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 { Future<bool> _collectCoverageData(CoverageCollector collector, { bool mergeCoverageData: false }) async {
final Status status = logger.startProgress('Collecting coverage information...'); final Status status = logger.startProgress('Collecting coverage information...');
final String coverageData = await collector.finalizeCoverage( final String coverageData = await collector.finalizeCoverage(
...@@ -159,7 +153,9 @@ class TestCommand extends FlutterCommand { ...@@ -159,7 +153,9 @@ class TestCommand extends FlutterCommand {
Directory workDir; Directory workDir;
if (files.isEmpty) { 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()) if (!workDir.existsSync())
throwToolExit('Test directory "${workDir.path}" not found.'); throwToolExit('Test directory "${workDir.path}" not found.');
files = _findTests(workDir); files = _findTests(workDir);
......
...@@ -18,7 +18,6 @@ import '../base/io.dart'; ...@@ -18,7 +18,6 @@ import '../base/io.dart';
import '../base/process_manager.dart'; import '../base/process_manager.dart';
import '../dart/package_map.dart'; import '../dart/package_map.dart';
import '../globals.dart'; import '../globals.dart';
import 'coverage_collector.dart';
import 'watcher.dart'; import 'watcher.dart';
/// The timeout we give the test process to connect to the test harness /// The timeout we give the test process to connect to the test harness
...@@ -53,7 +52,6 @@ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, ...@@ -53,7 +52,6 @@ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType,
/// main()`), you can set an observatory port and a diagnostic port explicitly. /// main()`), you can set an observatory port and a diagnostic port explicitly.
void installHook({ void installHook({
@required String shellPath, @required String shellPath,
CoverageCollector collector,
TestWatcher watcher, TestWatcher watcher,
bool enableObservatory: false, bool enableObservatory: false,
bool startPaused: false, bool startPaused: false,
......
...@@ -55,8 +55,8 @@ Future<int> runTests( ...@@ -55,8 +55,8 @@ Future<int> runTests(
serverType: serverType, serverType: serverType,
); );
// Set the package path used for child processes. // Make the global packages path absolute.
// TODO(skybrian): why is this global? Move to installHook? // (Makes sure it still works after we change the current directory.)
PackageMap.globalPackagesPath = PackageMap.globalPackagesPath =
fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath)); fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
......
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