flutter / flutter/flutter-intellij

Flutter Test run for normal Dart Tests

Open
#2,574 3 comments 2 reactions 0 assignees View on GitHub
topic-testing
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

Hello! I've been running into this bug more and more as I work on projects that contain some Flutter directories along-side plain-old-Dart projects or Angular Dart projects.

Use-case: I have a project with 3 directories:

- `app_base`: Pure Dart lib to be shared by an Angular and Flutter app
- `app_flutter`: Flutter app that relies on app_base
- `app_angular`: Angular app that relies on app_base

When I try to run tests in `app_base`, I get the following error:

```
Running "flutter packages get" in app_base...compiler message: Error: Could not resolve the package 'flutter_test' in 'package:flutter_test/flutter_test.dart'.
```

Which makes sense -- `app_base` shouldn't depend on Flutter! However, it seems like once you set the Flutter SDK for a project, it tries to run all tests as if they were Flutter tests. It would be great if the Flutter plugin either:

1. Allowed me to select which directories in my Project are Flutter directories (similar to the Dart plugin)
2. Understood the current directory is a Dart project, not a Flutter project, and ran good ol' Dart tests in that case

## Workaround

Create a Run config for Pure dart tests. This quickly becomes cumbersome, however -- if I want to run/debug a single test in a single file, I always need to create a new run config rather than allowing the IDE to run an erroneous flutter test

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.