Repository: flutter
Issue: "Dart compiler exited unexpectedly" running `flutter test` on a non-Flutter package
Labels: c: new feature,tool,P3,team-tool,triaged-tool

## Steps to Reproduce

I accidentally ran `flutter test` on a non-Flutter package and got "Dart compiler exited unexpectedly". While I do not expect `flutter test` to succeed running my tests in this package, I'd expect a more useful error message.

Currently this is reproducible by running `flutter test` on https://github.com/flutter/engine/tree/master/lib/web_ui.

<!--
     Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
     Which target OS version, for Web, browser, is the test system running?
     Does the problem occur on emulator/simulator as well as on physical devices?
-->

**Target Platform:** Linux

## Logs

`flutter test` output:

```
00:12 +0 -6: loading /home/yjbanov/code/flutter/engine/src/flutter/lib/web_ui/test/engine/recording_canvas_test.dart [E]
  Failed to load "/home/yjbanov/code/flutter/engine/src/flutter/lib/web_ui/test/engine/recording_canvas_test.dart":
  Compilation failed
  Test: /home/yjbanov/code/flutter/engine/src/flutter/lib/web_ui/test/engine/recording_canvas_test.dart
  Shell: /home/yjbanov/code/flutter/flutter/bin/cache/artifacts/engine/linux-x64/flutter_tester
  
  
00:12 +0 -6: loading /home/yjbanov/code/flutter/engine/src/flutter/lib/web_ui/test/text/word_breaker_test.dart [E]
  Exception: the Dart compiler exited unexpectedly.
  package:flutter_tools/src/base/common.dart 28:3               throwToolExit
  package:flutter_tools/src/compile.dart 625:9                  ResidentCompiler._compile.<fn>
  package:stack_trace/src/stack_zone_specification.dart 129:26  StackZoneSpecification._registerUnaryCallback.<fn>.<fn>
  package:stack_trace/src/stack_zone_specification.dart 209:15  StackZoneSpecification._run
  package:stack_trace/src/stack_zone_specification.dart 129:14  StackZoneSpecification._regist
```

`flutter doctor -v`:

```
[✓] Flutter (Channel unknown, v1.6.1-pre.1816, on Linux, locale en_US.UTF-8)
    • Flutter version 1.6.1-pre.1816 at /home/yjbanov/code/flutter/flutter
    • Framework revision 94f15559ea (2 days ago), 2019-10-07 09:37:14 -0700
    • Engine revision 7d90779bb6
    • Dart version 2.6.0 (build 2.6.0-dev.5.0 d6c6d12ebf)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /home/yjbanov/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /usr/local/buildtools/java/jdk/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_181-google-v7-270956655-270956655)
    • All Android licenses accepted.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[!] IntelliJ IDEA Ultimate Edition (version 2018.3)
    • IntelliJ at /opt/intellij-ue-2018.3
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    • Dart plugin version 183.5153.38
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at /opt/intellij-ue-2019.1
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    • Dart plugin version 191.7830
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.37.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.4.1

[!] Connected device
    ! No devices available

! Doctor found issues in 4 categories.
```