Skip to content

Using --define is not consistent across dart CLI commands #51791

Open
@pak3nuh

Description

@pak3nuh

Hey,

I'm developing a dart package that has some integration tests dependent on an outside service and I use the String.fromEnvironment method to get the value of a specific variable and not have it in the repository as code.

The thing is that the flag that adds environment variables doesn't seem to work consistently across dart CLI commands.

If I run the command

dart -DMY_VAR=my-value run some-dart-test.dart

it picks up the correct value of the var, but if I do the same with the test command it fails

dart -DMY_VAR=my-value test

Also the define flag doesn't seem to be documented anywhere in the CLI. I got a hold of how it works through stackoverflow entries and I don't know if I'm doing something wrong.

I'm using dart 2.19.4 on a Windows 10 machine.

Metadata

Metadata

Assignees

Labels

area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.dart-cli-testIssues related to the 'dart test' tool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions