24

Since the latest flutter update my tests are broken. It looks like the Dart test framework isn't available anymore:

error: Target of URI doesn't exist: 'package:test/test.dart'. 

2 Answers 2

35

If you've upgraded to a recent master, you'll find that flutter_test has removed its dependency on package:test. The package hasn't been removed or renamed, but you will need to specifically add it to you dev_dependencies in your pubspec now:

dev_dependencies:
  test: ^1.5.1

The test_api package is just used to unify the versioning and reduce the depencies of flutter_test. It didn't replace package:test. There are also no breaking changes in any of these newer test versions.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for the clarification. I have deleted my wrong answer.
I have a direct dependency on test and am not using Flutter, but recently have started receiving this error in VSCode.
Huh. Seems that this time, VSCode had gotten into a bad state and reloading it solved the issue. Not sure about the other times it happened though.
0

The problem for me targeted URI doesn't exist was due to lib folder inside test package was not available at file:///E:/APPS/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/dartz-0.9.2/lib/ so I downloaded it from GitHub and add it there manually and restarted the IDE. And It worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.