-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for -D arguments #1509
Comments
The flag should be named Have you tried |
yes also tried with ( Dart SDK version: 2.12.3 (stable) (Wed Apr 14 11:02:39 2021 +0200) on "macos_x64" ) |
dart test
doesn't recognize the --dart-define
flagdart test
doesn't recognize the --define
flag
dart test
doesn't recognize the --define
flagdart test
doesn't recognize the --define
or '-D' flag
the workaround seems to be : export DART_VM_OPTIONS='-Dfoo=true' && pub run test but it's not working with export DART_VM_OPTIONS='-Dfoo=true' && dart test final foo = const bool.fromEnvironment('foo'); // with dart test foo is false |
Importantly pass the |
|
dart test
doesn't recognize the --define
or '-D' flag
I'm not eager to support general I'll leave this issue open in case we decide later to add support for @jonahwilliams - does |
It does:
Note that if you keep the cached dill floating around you need to account for the exact defines used for it. |
If |
I don't think that with the new test loading strategy this would work either way? It may have accidentally worked previously, on the vm only, because we used data isolates and they inherited the defines. But that approach is actually setting the defines for the test runner itself as well which really isn't right. We also initialize from previously compiled dills and it is likely that we don't properly account for changes to the -D variables (well I know we don't do anything, idk if the frontend server notices a change automatically or not and invalidates the dill). |
This is not the way the VM works today. If I ignore the
I don't think it's a good idea in general to support different arguments between |
I'm not too familiar with how the test runner works, but the VM will parse VM options provided after commands before starting the CLI isolate. This is completely independent of the argument parser for the specified command, but the argument parser needs to accept the VM option as a valid option for the command so we don't error out. If the test runner just spawns another isolate in the original VM process, this should be the only change needed in the
While I agree on principle, the plan is to deprecate The other, slightly unrelated, issue is that the |
If I recall correctly that was not a plan that our team signed off on, but it may have become the plan since it was last discussed.
Yes, we are signed on to improve the UX for things like the usage output. I think we have some open issues around that but I haven't dug deeply yet. |
I think this is covered by dart-lang/pub#2736? Would there be any strong reason not to deprecate
Okay cool, just making sure! Thanks :-) |
I think the main reason is the implementation of the excutable will always be in the pub package (so that we can make breaking changes with versioning under the user's control). If we want to hide it such that If the "deprecation" is limited to a message saying "you may want to invoke this with |
Yeah, that's basically it. We won't be removing functionality from tools, just removing the standalone scripts in favor of the CLI commands at some point in the future. |
even if dart-lang/sdk#44562 is closed, it seems actually not possible to define environment variables fort the
dart test
command ?The text was updated successfully, but these errors were encountered: