From 65c6529a3ed80eb0809e4ddf2433972c61efec41 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Fri, 1 Nov 2019 11:48:53 -0400 Subject: [PATCH] chore: Add failing test for --all on pre-instrumented code --- tap-snapshots/test-instrument.js-TAP.test.js | 17 +++++++++++++++++ test/instrument.js | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tap-snapshots/test-instrument.js-TAP.test.js diff --git a/tap-snapshots/test-instrument.js-TAP.test.js b/tap-snapshots/test-instrument.js-TAP.test.js new file mode 100644 index 000000000..f1638f0e9 --- /dev/null +++ b/tap-snapshots/test-instrument.js-TAP.test.js @@ -0,0 +1,17 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/instrument.js TAP can write files in place with --in-place switch > stdout 1`] = ` +----------|---------|----------|---------|---------|------------------- +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +----------|---------|----------|---------|---------|------------------- +All files | 0 | 100 | 0 | 0 | + file1.js | 0 | 100 | 0 | 0 | 2,5 + file2.js | 0 | 100 | 0 | 0 | 2,5 +----------|---------|----------|---------|---------|------------------- + +` diff --git a/test/instrument.js b/test/instrument.js index b8127ed2c..6614d49fd 100644 --- a/test/instrument.js +++ b/test/instrument.js @@ -10,7 +10,7 @@ const cpFile = require('cp-file') const isWindows = require('is-windows')() const rimraf = promisify(require('rimraf')) -const { runNYC, fixturesCLI } = require('./helpers') +const { runNYC, testSuccess, fixturesCLI } = require('./helpers') const subdir = path.resolve(fixturesCLI, 'subdir') const outputDir = path.resolve(subdir, './output-dir') @@ -264,6 +264,11 @@ t.test('can write files in place with --in-place switch', async t => { const file2 = path.resolve(outputDir, 'file2.js') t.notMatch(await fs.readFile(file2, 'utf8'), /function cov_/) + + await testSuccess(t, { + args: ['--all', process.execPath, '-e', ''], + cwd: outputDir + }) }) t.test('aborts if trying to delete while writing files in place', async t => {