Skip to content

Support passing args to Dart VM when running tests #3685

@shyndman

Description

@shyndman

Describe the bug
I am attempting to run tests in a project that uses the constructor-tearoffs experiment, and I'm getting errors while running the test from inside VSCode.

I have attempted to use both vmAdditionalArgs in the launch config for that test, as well as dart.vmAdditionalArgs at the workspace level, but neither are passed along to the test.

Example of launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "server",
      "program": "test/server_test.dart",
      "request": "launch",
      "type": "dart",
      "vmAdditionalArgs": [
        "--enable-experiment=constructor-tearoffs",
      ]
    }
  ]
}

Example of my .code-workspace:

{
  "folders": [],
  "settings": {
    "dart.vmAdditionalArgs": [
      "--enable-experiment=constructor-tearoffs"
    ],
  }
}

I have verified that the VM args do work as expected launching something other than a test.

I have also verified that dart test --enable-experiment=constructor-tearoffs works fine from the commandline.

To Reproduce

  1. Create a project that uses constructor tear-offs
  2. Write a test file that references the library containing tear-offs
  3. Attempt to run using methods described above

Expected behavior
That the tests run without analysis failure.

Versions (please complete the following information):

  • VS Code version: v1.62.3
  • Dart extension version: v3.28.0
  • Dart/Flutter SDK version: v2.15.0-42.0.dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions