Fix default source overriding config file #123
Closed
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.
Description (What)
Because the
source
property was being defaulted to[]
on the CLI, this code would never allow the config file to override the default value.src/get-context/get-config/index.ts:81
Essentially,
fromCli
is always set, so thefromRcFile
is never even looked at.I think the best way to fix this is to allow
getConfig()
from that file to return a default value if nothing is set. Not sure if that's the best place to put this, but it at least puts the default where every part of the code will pull it fromJustification (Why)
It would be nice if the documentation about the configuration file actually worked the way it says it will
How Can This Be Tested?
This test was incorrect.
src/get-context/get-config/get-config.spec.ts:156-161
const config = getConfig(disk, {})
was an incorrect state.const config = getConfig(disk, { source: [] })
** You'll see that it throws an error