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 {
@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 @@ class TestCommand extends FlutterCommand {
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);
......
......@@ -18,7 +18,6 @@ import '../base/io.dart';
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 @@ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType,
/// 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,
......
......@@ -55,8 +55,8 @@ Future<int> runTests(
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));
......
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