flutter.el icon indicating copy to clipboard operation
flutter.el copied to clipboard

Test invocations fail on pure-Dart files in Flutter project

Open amake opened this issue 5 years ago • 3 comments

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.

amake avatar May 22 '20 12:05 amake

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

ericdallo avatar May 22 '20 14:05 ericdallo

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.

amake avatar May 22 '20 14:05 amake

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

ericdallo avatar May 22 '20 14:05 ericdallo