From 3932a22cdfb08aea8cd6e81a96cab04f5409ada0 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Thu, 15 Feb 2018 16:57:52 +0100 Subject: [PATCH] When running tests with --preview-dart-2 check for compilation errors. (#14724) If compiler failed to produce Kernel binary then compile(...) returns null to the caller. If we don't check for null we end up trying to run file called "null" which causes a very confusing crash of the flutter_tester. --- packages/flutter_tools/lib/src/test/flutter_platform.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index 1ac38b0cf77..abb4a73e148 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart @@ -211,6 +211,11 @@ class _FlutterPlatform extends PlatformPlugin { packagesPath: PackageMap.globalPackagesPath, ); + if (mainDart == null) { + controller.sink.addError(_getErrorMessage('Compilation failed', testPath, shellPath)); + return null; + } + // bundlePath needs to point to a folder with `platform.dill` file. final Directory tempBundleDirectory = fs.systemTempDirectory .createTempSync('flutter_bundle_directory');