Test framework quit unexpectedly - Dart project on MAC

898

I had the error messages: "Test framework quit unexpectedly" "The flutter SDK is not available"

The problem was that I configure the unit tests as Dart tests.

Solution in InteliJ: Run > Edit Configurations... > + symbol on the top left > Flutter Test (to use the Flutter template instead of the Dart template)

Test scope: All in Directory and choose your_project/lib folder. This will search for all files named as *_test.dart

This thread helped figuring this out: dart:ui:1: Error: Not found: dart:ui. flutter/dart:

Share:
898
SEG.Veenstra
Author by

SEG.Veenstra

Fully Focused on Flutter!

Updated on December 10, 2022

Comments

  • SEG.Veenstra
    SEG.Veenstra 11 months

    I'm trying to develop a Dart package for my Flutter project. It only consists of Dart (so no Flutter) code.

    When trying to run my unit tests with Android Studio or IntelliJ I get the following error: Test framework quit unexpectedly In the output window I get the following messages:

    Testing started at 21:38 ...
    /Users/<user>/development/flutter/bin/cache/dart-sdk/bin/pub run test -r json /Users/<user>/Projects/personal/<project dir>/<project>
    Observatory listening on http://127.0.0.1:57505/
    
    Could not find a file named "pubspec.yaml" in "/Users/<user>/.pub-cache/hosted/pub.dartlang.org/test-1.5.3".
    
    Process finished with exit code 66
    

    The whole .pub-cache directory doesn't even exists...

    How do I get the testing to work?