Skip to content

Commit

Permalink
Fix test/test-options when run through npm test.
Browse files Browse the repository at this point in the history
`npm test` dumps a ton of npm_config_* variables in the environment.
Remove those before starting the actual test.

PR-URL: #755
Reviewed-By: Rod Vagg <[email protected]>
  • Loading branch information
bnoordhuis committed Nov 19, 2015
1 parent 9bfa087 commit 0e2dfda
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ var gyp = require('../lib/node-gyp')
test('options in environment', function (t) {
t.plan(1)

// `npm test` dumps a ton of npm_config_* variables in the environment.
Object.keys(process.env)
.filter(function(key) { return /^npm_config_/.test(key) })
.forEach(function(key) { delete process.env[key] })

// Zero-length keys should get filtered out.
process.env.npm_config_ = '42'
// Other keys should get added.
Expand Down

0 comments on commit 0e2dfda

Please sign in to comment.