[flutter_tools] allow using flutter test for testing the tool too (#69911)

This commit is contained in:
Jonah Williams
2020-11-12 13:52:09 -08:00
committed by GitHub
parent a0ec4d67e9
commit 5fedad9173
8 changed files with 58 additions and 43 deletions

View File

@@ -188,6 +188,8 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
@override List<String> extraFrontEndOptions,
bool nullAssertions = false,
BuildInfo buildInfo,
String reporter,
String timeout,
}) async {
lastEnableObservatoryValue = enableObservatory;
return exitCode;

View File

@@ -33,7 +33,7 @@ void main() {
fileSystem.file('test/foo.dart').createSync(recursive: true);
fileSystem.file('.packages')
..createSync()
..writeAsStringSync('flutter_test:flutter_test/');
..writeAsStringSync('test_api:test_api/\n');
residentCompiler = MockResidentCompiler();
});
@@ -109,7 +109,7 @@ void main() {
Logger: () => BufferLogger.test(),
});
testUsingContext('TestCompiler reports an error when there is no dependency on flutter_test', () async {
testUsingContext('TestCompiler reports an error when there is no dependency on flutter_test or test', () async {
final FakeTestCompiler testCompiler = FakeTestCompiler(
BuildInfo.debug,
FlutterProject.current(),
@@ -118,7 +118,8 @@ void main() {
fileSystem.file('.packages').writeAsStringSync('\n');
expect(await testCompiler.compile(Uri.parse('test/foo.dart')), null);
expect(testLogger.errorText, contains('Error: cannot run without a dependency on "package:flutter_test"'));
expect(testLogger.errorText, contains('Error: cannot run without a dependency on '
'either "package:flutter_test" or "package:test'));
verifyNever(residentCompiler.recompile(
any,
<Uri>[Uri.parse('test/foo.dart')],