Unverified Commit 58397108 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Throw a better error when old test versions are loaded. (#24217)

parent a871d591
......@@ -414,10 +414,25 @@ class _FlutterPlatform extends PlatformPlugin {
) async {
// loadChannel may throw an exception. That's fine; it will cause the
// LoadSuite to emit an error, which will be presented to the user.
final StreamChannel<dynamic> channel = loadChannel(path, platform);
final RunnerSuiteController controller = deserializeSuite(path, platform,
// Except for the Declarer error, which is a specific test incompatibility
// error we need to catch.
try {
final StreamChannel<dynamic> channel = loadChannel(path, platform);
final RunnerSuiteController controller = deserializeSuite(path, platform,
suiteConfig, const PluginEnvironment(), channel, message);
return await controller.suite;
return await controller.suite;
} catch (err) {
/// Rethrow a less confusing error if it is a test incompatibility.
if (err.toString().contains('type \'Declarer\' is not a subtype of type \'Declarer\'')) {
throw UnsupportedError('Package incompatibility between flutter and test packages:\n'
' * flutter is incompatible with test <1.4.0.\n'
' * flutter is incompatible with mockito <4.0.0\n'
'To fix this error, update test to at least \'^1.4.0\' and mockito to at least \'^4.0.0\'\n'
);
}
// Guess it was a different error.
rethrow;
}
}
@override
......
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