Remove the warning about the Integration Test plugin (#79520)

This commit is contained in:
Jia Hao
2021-04-02 09:49:02 +08:00
committed by GitHub
parent 42c5f71c52
commit e868a8335b
4 changed files with 66 additions and 17 deletions

View File

@@ -401,6 +401,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
if (_isIntegrationTest) {
integrationTestDevice = await findTargetDevice();
// Disable reporting of test results to native test frameworks. This isn't
// needed as the Flutter Tool will be responsible for reporting results.
buildInfo.dartDefines.add('INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false');
if (integrationTestDevice == null) {
throwToolExit(
'No devices are connected. '

View File

@@ -582,6 +582,30 @@ dev_dependencies:
FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.web),
]),
});
testUsingContext('Integration tests set the correct dart-defines', () async {
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
final TestCommand testCommand = TestCommand(testRunner: testRunner);
final CommandRunner<void> commandRunner = createTestCommandRunner(testCommand);
await commandRunner.run(const <String>[
'test',
'--no-pub',
'integration_test',
]);
expect(
testRunner.lastDebuggingOptionsValue.buildInfo.dartDefines,
contains('INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false'),
);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
DeviceManager: () => _FakeDeviceManager(<Device>[
FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.android),
]),
});
}
class FakeFlutterTestRunner implements FlutterTestRunner {
@@ -589,6 +613,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
int exitCode;
bool lastEnableObservatoryValue;
DebuggingOptions lastDebuggingOptionsValue;
@override
Future<int> runTests(
@@ -626,6 +651,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
String integrationTestUserIdentifier,
}) async {
lastEnableObservatoryValue = enableObservatory;
lastDebuggingOptionsValue = debuggingOptions;
return exitCode;
}
}