[flutter_tools] add support for dart defines to flutter test (#70791)
This commit is contained in:
@@ -114,29 +114,6 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Logger: () => BufferLogger.test(),
|
||||
});
|
||||
|
||||
testUsingContext('TestCompiler reports an error when there is no dependency on flutter_test or test', () async {
|
||||
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
||||
BuildInfo.debug,
|
||||
FlutterProject.current(),
|
||||
residentCompiler,
|
||||
);
|
||||
|
||||
expect(await testCompiler.compile(Uri.parse('test/foo.dart')), null);
|
||||
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')],
|
||||
outputPath: testCompiler.outputDill.path,
|
||||
packageConfig: anyNamed('packageConfig'),
|
||||
));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
Platform: () => linuxPlatform,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Logger: () => BufferLogger.test(),
|
||||
});
|
||||
}
|
||||
|
||||
/// Override the creation of the Resident Compiler to simplify testing.
|
||||
|
||||
@@ -82,6 +82,11 @@ void main() {
|
||||
return _testFile('package_assets', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero);
|
||||
});
|
||||
|
||||
testWithoutContext('flutter test should support dart defines', () async {
|
||||
return _testFile('dart_defines', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero,
|
||||
extraArguments: <String>['--dart-define=flutter.test.foo=bar']);
|
||||
});
|
||||
|
||||
testWithoutContext('flutter test should run a test when its name matches a regexp', () async {
|
||||
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
|
||||
extraArguments: const <String>['--name', 'inc.*de']);
|
||||
|
||||
Reference in New Issue
Block a user