mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
chore: refactor the creation of config.gypi file
This commit is contained in:
parent
bc47cd60b9
commit
f2ad87ff65
4 changed files with 162 additions and 97 deletions
37
test/test-create-config-gypi.js
Normal file
37
test/test-create-config-gypi.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const gyp = require('../lib/node-gyp')
|
||||
const createConfigGypi = require('../lib/create-config-gypi')
|
||||
const { getCurrentConfigGypi } = createConfigGypi.test
|
||||
|
||||
test('config.gypi with no options', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
const prog = gyp()
|
||||
prog.parseArgv([])
|
||||
|
||||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
|
||||
t.equal(config.target_defaults.default_configuration, 'Release')
|
||||
t.equal(config.variables.target_arch, process.arch)
|
||||
})
|
||||
|
||||
test('config.gypi with --debug', function (t) {
|
||||
t.plan(1)
|
||||
|
||||
const prog = gyp()
|
||||
prog.parseArgv(['_', '_', '--debug'])
|
||||
|
||||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
|
||||
t.equal(config.target_defaults.default_configuration, 'Debug')
|
||||
})
|
||||
|
||||
test('config.gypi with custom options', function (t) {
|
||||
t.plan(1)
|
||||
|
||||
const prog = gyp()
|
||||
prog.parseArgv(['_', '_', '--shared-libxml2'])
|
||||
|
||||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
|
||||
t.equal(config.variables.shared_libxml2, true)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue