diff --git a/package.json b/package.json index e0aa83eb7..c073e711e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lint": "standard", "pretest": "npm run lint && npm run clean && npm run instrument", "test": "tap -t360 --no-cov -b test/*.js", - "snap": "cross-env TAP_SNAPSHOT=1 tap -t360 --no-cov -b test/*.js", + "snap": "cross-env TAP_SNAPSHOT=1 npm test", "posttest": "npm run report", "clean": "rimraf ./.nyc_output ./node_modules/.cache ./.self_coverage ./test/fixtures/.nyc_output ./test/fixtures/node_modules/.cache ./self-coverage", "instrument": "node ./build-self-coverage.js", diff --git a/tap-snapshots/test-nyc-integration.js-TAP.test.js b/tap-snapshots/test-nyc-integration.js-TAP.test.js index df52956a9..a53ebecbd 100644 --- a/tap-snapshots/test-nyc-integration.js-TAP.test.js +++ b/tap-snapshots/test-nyc-integration.js-TAP.test.js @@ -190,15 +190,44 @@ All files | 50 | 50 | 100 | 50 | ` exports[`test/nyc-integration.js TAP passes configuration via environment variables > undefined 1`] = ` -{ silent: true, - cache: false, - sourceMap: true, - require: 'make-dir', - include: 'env.js', - exclude: 'batman.js', - extension: '.js', - cacheDir: '/tmp', - instrumenter: './lib/instrumenters/istanbul' } +[ + [ + "cache", + false + ], + [ + "cacheDir", + "/tmp" + ], + [ + "exclude", + "batman.js" + ], + [ + "extension", + ".js" + ], + [ + "include", + "env.js" + ], + [ + "instrumenter", + "./lib/instrumenters/istanbul" + ], + [ + "require", + "make-dir" + ], + [ + "silent", + true + ], + [ + "sourceMap", + true + ] +] ` exports[`test/nyc-integration.js TAP allows package.json configuration to be overridden with command line args > stdout 1`] = ` diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 54f34da9d..e0e7ab47f 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -97,14 +97,17 @@ t.test('passes configuration via environment variables', t => { 'extension' ] - const { NYC_CONFIG } = JSON.parse(stdout) - const config = JSON.parse(NYC_CONFIG, (key, value) => { - return key === '' || checkOptions.includes(key) ? value : undefined - }) + const config = JSON.parse(JSON.parse(stdout).NYC_CONFIG) t.is(status, 0) t.is(stderr, '') - t.matchSnapshot(config) + t.matchSnapshot( + JSON.stringify( + checkOptions.sort().map(option => [option, config[option]]), + null, + 2 + ) + ) }) })