source: trip-planner-front/node_modules/node-gyp/test/test-options.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 923 bytes
RevLine 
[6a3a178]1'use strict'
2
3const test = require('tap').test
4const gyp = require('../lib/node-gyp')
5
6test('options in environment', (t) => {
7 t.plan(1)
8
9 // `npm test` dumps a ton of npm_config_* variables in the environment.
10 Object.keys(process.env)
11 .filter((key) => /^npm_config_/.test(key))
12 .forEach((key) => { delete process.env[key] })
13
14 // in some platforms, certain keys are stubborn and cannot be removed
15 const keys = Object.keys(process.env)
16 .filter((key) => /^npm_config_/.test(key))
17 .map((key) => key.substring('npm_config_'.length))
18 .concat('argv', 'x')
19
20 // Zero-length keys should get filtered out.
21 process.env.npm_config_ = '42'
22 // Other keys should get added.
23 process.env.npm_config_x = '42'
24 // Except loglevel.
25 process.env.npm_config_loglevel = 'debug'
26
27 const g = gyp()
28 g.parseArgv(['rebuild']) // Also sets opts.argv.
29
30 t.deepEqual(Object.keys(g.opts).sort(), keys.sort())
31})
Note: See TracBrowser for help on using the repository browser.