Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test invocations fail on pure-Dart files in Flutter project #13

Open
amake opened this issue May 22, 2020 · 3 comments
Open

Test invocations fail on pure-Dart files in Flutter project #13

amake opened this issue May 22, 2020 · 3 comments

Comments

@amake
Copy link
Owner

amake commented May 22, 2020

In an effort to support running tests in pure-Dart projects (because you may want to work on a pure-Dart project for use in a Flutter project), we try to be smart about which invocation to use: flutter test or pub run test.

But we are not smart enough: we assume a Flutter project only if the file has a import package:flutter(_test)?/... statement, and otherwise assume a Dart project.

This falls down for pure-Dart files in Flutter packages.

We need some cheap way of determining whether the project is a Flutter one or not.

@ericdallo
Copy link
Contributor

The way VSCode dart extension and lsp-dart handles this is checking the pubspec.yml file on project root then searching for a flutter SDK regex dependency :)
https://github.com/emacs-lsp/lsp-dart/blob/master/lsp-dart-utils.el#L44-L51

@amake
Copy link
Owner Author

amake commented May 22, 2020

Thanks! Yeah I was hoping for something possible without reading the contents of any files, but that does seem to be the most foolproof way.

@ericdallo
Copy link
Contributor

Yeah, me too 😅 , but it seems to be working very well for VSCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants