Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Refresh snapshots, update test/config-override.js to use helpe…
…rs (#1085)
- Loading branch information
1 parent
3d9eaa4
commit 1e39ae1
Showing
2 changed files
with
15 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,15 @@ | ||
const { spawn } = require('child_process') | ||
const { resolve } = require('path') | ||
'use strict' | ||
|
||
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))) | ||
const { tempDirSetup, testSuccess } = require('./helpers') | ||
|
||
tempDirSetup(t, __filename) | ||
|
||
t.test('spawn that does config overriding', t => { | ||
const args = [ | ||
bin, '-t', tmp, | ||
t.test('spawn that does config overriding', t => testSuccess(t, { | ||
args: [ | ||
'--exclude-after-remap=false', | ||
'--include=conf-override-root.js', | ||
node, 'conf-override-root.js' | ||
process.execPath, '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() | ||
}) | ||
}) | ||
})) |