I'm trying to run flutter test using the terminal and i receive the following error. the following file C:/Users/User/AppData/Local/Temp/flutter_test_listener.e6fa92b4-6cd1-11e9-b9cb-68f728ca4610/listener.dart doesn't exist in the directory specified.
here's the error:
Compiler message: file:///C:/Users/User-45/AppData/Local/Temp/flutter_test_listener.e6fa92b4-6cd1-11e9-b9cb-68f728ca4610/listener.dart:46:17:
Error:Getter not found: 'main'. return test.main;
my project's directory is in another folder. how can i solve this? Thank you
In my case, it happened that one of my helper classes in the test folder, had a name that ended "_test", and the compiler was looking for a main method. So I renamed the helper class, and problem solved.
If anybody faces the above problem then try to add main()
in test class and if you have added then remove it out of test class curly braces. I faced this and removed the main()
out of test class.
Eg...
class GetConcreteNumberTrivia_Test extends Mock
implements NumberTriviaRepository {}
void main() {
.....my implementation......
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With