File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -273,14 +273,14 @@ function parse (args, opts) {
273273
274274 // order of precedence:
275275 // 1. command line arg
276- // 2. value from config file
277- // 3. value from config objects
278- // 4. value from env var
276+ // 2. value from env var
277+ // 3. value from config file
278+ // 4. value from config objects
279279 // 5. configured default value
280280 applyEnvVars ( argv , true ) // special case: check env vars that point to config file
281+ applyEnvVars ( argv , false )
281282 setConfig ( argv )
282283 setConfigObjects ( )
283- applyEnvVars ( argv , false )
284284 applyDefaultsAndAliases ( argv , flags . aliases , defaults )
285285 applyCoercions ( argv )
286286
Original file line number Diff line number Diff line change @@ -1697,7 +1697,7 @@ describe('yargs-parser', function () {
16971697 } )
16981698
16991699 var jsonPath = path . resolve ( __dirname , './fixtures/config.json' )
1700- it ( 'should prefer config file value over env var ' , function ( ) {
1700+ it ( 'should prefer environment variables over config file ' , function ( ) {
17011701 process . env . CFG_HERP = 'zerp'
17021702 var result = parser ( [ '--cfg' , jsonPath ] , {
17031703 envPrefix : 'CFG' ,
@@ -1708,7 +1708,7 @@ describe('yargs-parser', function () {
17081708 }
17091709 } )
17101710
1711- result . herp . should . equal ( 'derp ' )
1711+ result . herp . should . equal ( 'zerp ' )
17121712 } )
17131713
17141714 it ( 'should support an env var value as config file option' , function ( ) {
You can’t perform that action at this time.
0 commit comments