Skip to content

Customizable flutter test command #2915

@bencehornak

Description

@bencehornak

Is your feature request related to a problem? Please describe.
I want to customize the execution of some flutter tests on my development machine. For example, there are some tests I don't want to run locally, only in a CI environment. I could achieve this by adding --exclude-tags my-tag args to the flutter test command of the extension. Another example is, that I would love to add --coverage flag to the flutter test command, to generate test coverage report.

Describe the solution you'd like
The existing list of ...AdditionalArgs configuration properties (flutterAdditionalArgs, pubAdditionalArgs, analyzerAdditionalArgs, vmAdditionalArgs, buildRunnerAdditionalArgs) could be extended by the proposed flutterTestAdditionalArgs, whose value would be added to the args of the flutter test command.

Describe alternatives you've considered

  • I tried to add --coverage to flutterAdditionalArgs, which worked for the tests, but made the regular debug sessions fail
  • I tried to use dart_test.yaml, though currently flutter test doesn't support profiles, so I cannot create distinct environment for the development and the CI
  • I created the following launch configuration and added the extra args there, but it did not have impact on other ways I can launch tests (e.g. using the Dart: Run all Tests command or clicking the Debug button above the declaration of the test group)
{
    "name": "Run tests",
    "type": "dart",
    "request": "launch",
    "program": "./test/",
    "args": ["--coverage", "exclude_tags", "my-tag"]
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    in testingRelates to test execution of Dart/Flutter tests for end usersis enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions