3 var test = require('tape')
4 var gyp = require('../lib/node-gyp')
6 test('options in environment', function (t) {
9 // `npm test` dumps a ton of npm_config_* variables in the environment.
10 Object.keys(process.env)
11 .filter(function(key) { return /^npm_config_/.test(key) })
12 .forEach(function(key) { delete process.env[key] })
14 // Zero-length keys should get filtered out.
15 process.env.npm_config_ = '42'
16 // Other keys should get added.
17 process.env.npm_config_x = '42'
19 process.env.npm_config_loglevel = 'debug'
22 g.parseArgv(['rebuild']) // Also sets opts.argv.
24 t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x'])