Skip to content

Commit

Permalink
chore: Refresh snapshots, update test/config-override.js to use helpe…
Browse files Browse the repository at this point in the history
…rs (#1085)
  • Loading branch information
coreyfarrell committed Apr 24, 2019
1 parent 3d9eaa4 commit 1e39ae1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 29 deletions.
8 changes: 6 additions & 2 deletions tap-snapshots/test-nyc-integration.js-TAP.test.js
Expand Up @@ -24,6 +24,8 @@ All files | 0 | 0 | 0 | 0 |
args.js | 0 | 100 | 100 | 0 | 1 |
by-arg2.js | 0 | 0 | 100 | 0 | 1,2,3,4,5,7 |
classes.js | 0 | 100 | 0 | 0 | 5,6,11,15 |
conf-override-module.js | 0 | 100 | 100 | 0 | 1,2 |
conf-override-root.js | 0 | 0 | 100 | 0 | 1,2,4,5,6,22,23 |
empty.js | 0 | 0 | 0 | 0 | |
env.js | 0 | 100 | 100 | 0 | 1 |
es6.js | 0 | 100 | 0 | 0 |... 11,16,17,22,23 |
Expand Down Expand Up @@ -77,11 +79,13 @@ exports[`test/nyc-integration.js TAP --ignore-class-method skips methods that ma
---------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------------|----------|----------|----------|----------|-------------------|
All files | 1.61 | 0 | 5.56 | 2.15 | |
cli | 2.33 | 0 | 5.56 | 3.64 | |
All files | 1.5 | 0 | 5.56 | 1.96 | |
cli | 2.11 | 0 | 5.56 | 3.13 | |
args.js | 0 | 100 | 100 | 0 | 1 |
by-arg2.js | 0 | 0 | 100 | 0 | 1,2,3,4,5,7 |
classes.js | 66.67 | 100 | 50 | 66.67 | 6 |
conf-override-module.js | 0 | 100 | 100 | 0 | 1,2 |
conf-override-root.js | 0 | 0 | 100 | 0 | 1,2,4,5,6,22,23 |
empty.js | 0 | 0 | 0 | 0 | |
env.js | 0 | 100 | 100 | 0 | 1 |
es6.js | 0 | 100 | 0 | 0 |... 11,16,17,22,23 |
Expand Down
36 changes: 9 additions & 27 deletions test/config-override.js
@@ -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()
})
})
}))

0 comments on commit 1e39ae1

Please sign in to comment.