-
-
Notifications
You must be signed in to change notification settings - Fork 350
/
config-override.js
33 lines (31 loc) · 957 Bytes
/
config-override.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { spawn } = require('child_process')
const { resolve } = require('path')
const t = require('tap')
const node = process.execPath
const fixturesCLI = resolve(__dirname, './fixtures/cli')
const bin = resolve(__dirname, '../self-coverage/bin/nyc')
const rimraf = require('rimraf').sync
const tmp = 'conf-override-test'
rimraf(resolve(fixturesCLI, tmp))
t.teardown(() => rimraf(resolve(fixturesCLI, tmp)))
t.test('spawn that does config overriding', t => {
const args = [
bin, '-t', tmp,
'--exclude-after-remap=false',
'--include=conf-override-root.js',
node, 'conf-override-root.js'
]
const proc = spawn(node, args, {
cwd: fixturesCLI
})
const out = []
const err = []
proc.stdout.on('data', c => out.push(c))
proc.stderr.on('data', c => err.push(c))
proc.on('close', (code, signal) => {
t.equal(code, 0)
t.equal(signal, null)
t.matchSnapshot(Buffer.concat(out).toString(), 'stdout')
t.end()
})
})