From 39e741dfb7904c3652297d737cd4b308f210122a Mon Sep 17 00:00:00 2001 From: Yegor Date: Wed, 4 May 2016 14:08:16 -0700 Subject: [PATCH] [tools] remove --flutter-repo flag in `flutter test` (#3728) --- CONTRIBUTING.md | 1 - .../flutter_tools/lib/src/commands/test.dart | 33 ++++--------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 051b1c588f2..a8c9cb395d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,7 +83,6 @@ Flutter tests use [package:flutter_test](https://github.com/flutter/flutter/tree * `cd packages/flutter_tools` * `dart test/all.dart` -`flutter test --flutter-repo` is a shortcut for those working on the flutter repository itself which runs all tests inside the `flutter` package regardless of the current working directory. To run all the tests for the entire Flutter repository, the same way that Travis runs them, run `travis/test.sh`. If you've built [your own flutter engine](#working-on-the-engine-and-the-framework-at-the-same-time), you can pass `--engine-debug` or `--engine-release` to change what flutter shell `flutter test` uses. diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 16340e23da0..e9d6fffa449 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -11,17 +11,11 @@ import 'package:test/src/executable.dart' as executable; // ignore: implementati import '../artifacts.dart'; import '../build_configuration.dart'; import '../globals.dart'; -import '../package_map.dart'; import '../runner/flutter_command.dart'; import '../test/flutter_platform.dart' as loader; class TestCommand extends FlutterCommand { TestCommand() { - argParser.addFlag( - 'flutter-repo', - help: 'Run tests from the \'flutter\' package in the Flutter repository instead of the current directory.', - defaultsTo: false - ); usesPubOption(); } @@ -31,20 +25,17 @@ class TestCommand extends FlutterCommand { @override String get description => 'Run Flutter unit tests for the current project (Linux only).'; - @override - bool get shouldRunPub => !argResults['flutter-repo'] && super.shouldRunPub; - @override bool get requiresProjectRoot => false; @override Validator projectRootValidator = () { if (!FileSystemEntity.isFileSync('pubspec.yaml')) { - printError('Error: No pubspec.yaml file found.\n' - 'If you wish to run the tests in the Flutter repository\'s \'flutter\' package,\n' - 'pass --flutter-repo before any test paths. Otherwise, run this command from the\n' - 'root of your project. Test files must be called *_test.dart and must reside in\n' - 'the package\'s \'test\' directory (or one of its subdirectories).'); + printError( + 'Error: No pubspec.yaml file found in the current working directory.\n' + 'Run this command from the root of your project. Test files must be\n' + 'called *_test.dart and must reside in the package\'s \'test\'\n' + 'directory (or one of its subdirectories).'); return false; } return true; @@ -74,10 +65,6 @@ class TestCommand extends FlutterCommand { .map((FileSystemEntity entity) => path.absolute(entity.path)); } - Directory get _flutterUnitTestDir { - return new Directory(path.join(ArtifactStore.flutterRoot, 'packages', 'flutter', 'test')); - } - 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. @@ -98,16 +85,10 @@ class TestCommand extends FlutterCommand { Future runInProject() async { List testArgs = argResults.rest.map((String testPath) => path.absolute(testPath)).toList(); - final bool runFlutterTests = argResults['flutter-repo']; - if (!runFlutterTests && !projectRootValidator()) + if (!projectRootValidator()) return 1; - // If we're running the flutter tests, we want to use the packages directory - // from the flutter package in order to find the proper shell binary. - if (runFlutterTests) - PackageMap.instance = new PackageMap(path.join(ArtifactStore.flutterRoot, 'packages', 'flutter', '.packages')); - - Directory testDir = runFlutterTests ? _flutterUnitTestDir : _currentPackageTestDir; + Directory testDir = _currentPackageTestDir; if (testArgs.isEmpty) { if (!testDir.existsSync()) {