From 1e39ae1aeaff332119a63f380ea2b0a78d6f320a Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Wed, 24 Apr 2019 15:14:01 -0400 Subject: [PATCH] chore: Refresh snapshots, update test/config-override.js to use helpers (#1085) --- .../test-nyc-integration.js-TAP.test.js | 8 +++-- test/config-override.js | 36 +++++-------------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/tap-snapshots/test-nyc-integration.js-TAP.test.js b/tap-snapshots/test-nyc-integration.js-TAP.test.js index a53ebecbd..258658297 100644 --- a/tap-snapshots/test-nyc-integration.js-TAP.test.js +++ b/tap-snapshots/test-nyc-integration.js-TAP.test.js @@ -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 | @@ -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 | diff --git a/test/config-override.js b/test/config-override.js index c459a87ee..b7263ea11 100644 --- a/test/config-override.js +++ b/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() - }) -}) +}))