source: node_modules/node-gyp/test/test-create-config-gypi.js@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1'use strict'
2
3const path = require('path')
4const { test } = require('tap')
5const gyp = require('../lib/node-gyp')
6const createConfigGypi = require('../lib/create-config-gypi')
7const { parseConfigGypi, getCurrentConfigGypi } = createConfigGypi.test
8
9test('config.gypi with no options', async function (t) {
10 t.plan(2)
11
12 const prog = gyp()
13 prog.parseArgv([])
14
15 const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
16 t.equal(config.target_defaults.default_configuration, 'Release')
17 t.equal(config.variables.target_arch, process.arch)
18})
19
20test('config.gypi with --debug', async function (t) {
21 t.plan(1)
22
23 const prog = gyp()
24 prog.parseArgv(['_', '_', '--debug'])
25
26 const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
27 t.equal(config.target_defaults.default_configuration, 'Debug')
28})
29
30test('config.gypi with custom options', async function (t) {
31 t.plan(1)
32
33 const prog = gyp()
34 prog.parseArgv(['_', '_', '--shared-libxml2'])
35
36 const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
37 t.equal(config.variables.shared_libxml2, true)
38})
39
40test('config.gypi with nodedir', async function (t) {
41 t.plan(1)
42
43 const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')
44
45 const prog = gyp()
46 prog.parseArgv(['_', '_', `--nodedir=${nodeDir}`])
47
48 const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })
49 t.equal(config.variables.build_with_electron, true)
50})
51
52test('config.gypi with --force-process-config', async function (t) {
53 t.plan(1)
54
55 const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')
56
57 const prog = gyp()
58 prog.parseArgv(['_', '_', '--force-process-config', `--nodedir=${nodeDir}`])
59
60 const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })
61 t.equal(config.variables.build_with_electron, undefined)
62})
63
64test('config.gypi parsing', function (t) {
65 t.plan(1)
66
67 const str = "# Some comments\n{'variables': {'multiline': 'A'\n'B'}}"
68 const config = parseConfigGypi(str)
69 t.deepEqual(config, { variables: { multiline: 'AB' } })
70})
Note: See TracBrowser for help on using the repository browser.