-
Notifications
You must be signed in to change notification settings - Fork 119
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
Added config-dot-notation
for config files.
#190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,6 +567,7 @@ describe('yargs-parser', function () { | |
it('should load nested options from config file', function () { | ||
var jsonPath = path.resolve(__dirname, './fixtures/nested_config.json') | ||
var argv = parser(['--settings', jsonPath, '--nested.foo', 'bar'], { | ||
configuration: { 'config-dot-notation': true }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this logic should need to change because we don't have keys of the form "foo.bar"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I see what you mean, but it fails without it. Ok, I'll have to look into this one more, tomorrow or Friday. |
||
config: ['settings'] | ||
}) | ||
|
||
|
@@ -718,6 +719,7 @@ describe('yargs-parser', function () { | |
|
||
it('should load nested options from config object', function () { | ||
var argv = parser(['--nested.foo', 'bar'], { | ||
configuration: { 'config-dot-notation': true }, | ||
configObjects: [{ | ||
a: 'a', | ||
nested: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to add two tests, demonstrating "foo.bar" with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I was thinking of adding a test but I saw "does not append nested-object keys from config to top-level key" seems to be testing exactly that. Except, now that I look at it again, the only thing I would change is line 2100 change Or would you rather like me to add another test case for this? |
||
|
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.
This logic seems wrong to me, which I believe is why you've had to explicitly turn on
config-dot-notation
to get tests passing.What I believe we want, when
config-dot-notation
isfalse
is to still runsetConfigObject
(which takes care of merging the config file with our arguments.It's a specific edge-case you want to turn off, which is how someone handles a config file that looks like this: