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.
This commit is contained in:
Vyacheslav Egorov 2018-02-15 16:57:52 +01:00 committed by GitHub
parent c0c6c60b8f
commit 3932a22cdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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');