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
fix: ignore unset environment variables #536
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amcaplan
changed the title
Ignore unset environment variables
fix: ignore unset environment variables
Oct 23, 2022
amcaplan
commented
Oct 23, 2022
}, | ||
}) | ||
expect(out.flags.foo).to.be.true | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be 100% clear, both of these tests fail when run against main
, because in both cases the absent env var is interpreted as falsey:
2 failing
1) parse
env
boolean
ignores unset environment variables:
AssertionError: expected false to be undefined
at Context.<anonymous> (test/parser/parse.test.ts:921:36)
2) parse
env
boolean
uses default when environment variable is unset:
AssertionError: expected false to be true
+ expected - actual
-false
+true
at Context.<anonymous> (test/parser/parse.test.ts:931:36)
amcaplan
added a commit
to Shopify/cli
that referenced
this pull request
Oct 24, 2022
…ive flags Apparently these never worked anyway for boolean flags before oclif 1.16.1. Then they started working, but only to specify true; otherwise, they essentially force a false as though it were specified. More details: oclif/core#536
Closed
6 tasks
amcaplan
added a commit
to Shopify/cli
that referenced
this pull request
Oct 24, 2022
…ive flags Apparently these never worked anyway for boolean flags before oclif 1.16.1. Then they started working, but only to specify true; otherwise, they essentially force a false as though it were specified. More details: oclif/core#536
amcaplan
added a commit
to Shopify/cli
that referenced
this pull request
Oct 24, 2022
Upgrading oclif introduced bugs with boolean flags. Need to downgrade again until oclif/core#536 is merged to oclif.
amcaplan
added a commit
to Shopify/cli
that referenced
this pull request
Oct 24, 2022
Upgrading oclif introduced bugs with boolean flags. Need to downgrade again until oclif/core#536 is merged to oclif.
6 tasks
mdonnalley
approved these changes
Oct 31, 2022
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an
env
is set for a boolean flag, if the user doesn't actually specify the value in their ENV, it ends up being treated as though they'd specifiedfalse
. I don't think this is the correct behavior; instead, it should be considered unspecified.This is especially relevant in 2 cases:
default: true
. As soon as you add anenv
config, they now effectively default to false.