Skip to content

Commit

Permalink
Ensure --verbose flag is passed through to rc options. (#111)
Browse files Browse the repository at this point in the history
The `yarn` package manager sets `npm_config_argv` but does not set
`npm_config_loglevel` so this change allows use of verbose logging.
  • Loading branch information
lovell authored and vweevers committed Nov 3, 2019
1 parent a5ff6d3 commit b17c7cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''

// Get `prebuild-install` arguments that were passed to the `npm` command
if (env.npm_config_argv) {
var npmargs = ['prebuild', 'compile', 'build-from-source', 'debug']
var npmargs = ['prebuild', 'compile', 'build-from-source', 'debug', 'verbose']
try {
var npmArgv = JSON.parse(env.npm_config_argv).cooked
for (var i = 0; i < npmargs.length; ++i) {
Expand Down
4 changes: 3 additions & 1 deletion test/rc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ test('npm args are passed on from npm environment into rc', function (t) {
'--build-from-source',
'--download',
'https://foo.bar',
'--debug'
'--debug',
'--verbose'
]
})
}
runRc(t, '', env, function (rc) {
t.equal(rc['build-from-source'], true, '--build-from-source works')
t.equal(rc.compile, true, 'compile should be true')
t.equal(rc.debug, true, 'debug should be true')
t.equal(rc.verbose, true, 'verbose should be true')
t.equal(rc.download, 'https://foo.bar', 'download is set')
t.end()
})
Expand Down

0 comments on commit b17c7cb

Please sign in to comment.