diff --git a/lib/commands/check-coverage.js b/lib/commands/check-coverage.js index 8eb36eb50..de63cb2ed 100644 --- a/lib/commands/check-coverage.js +++ b/lib/commands/check-coverage.js @@ -7,6 +7,7 @@ exports.describe = 'check whether coverage is within thresholds provided' exports.builder = function (yargs) { yargs + .demandCommand(0, 0) .option('exclude', { alias: 'x', default: testExclude.defaultExclude, diff --git a/lib/commands/instrument.js b/lib/commands/instrument.js index f744faef6..701dcb6f7 100644 --- a/lib/commands/instrument.js +++ b/lib/commands/instrument.js @@ -9,6 +9,15 @@ exports.describe = 'instruments a file or a directory tree and writes the instru exports.builder = function (yargs) { return yargs + .demandCommand(0, 0) + .positional('input', { + describe: 'file or directory to instrument', + type: 'text' + }) + .positional('output', { + describe: 'directory to output instrumented files', + type: 'text' + }) .option('require', { alias: 'i', default: [], diff --git a/lib/commands/merge.js b/lib/commands/merge.js index 072cfc450..98c6ff2d0 100644 --- a/lib/commands/merge.js +++ b/lib/commands/merge.js @@ -11,6 +11,7 @@ exports.describe = 'merge istanbul format coverage output in a given folder' exports.builder = function (yargs) { return yargs + .demandCommand(0, 0) .positional('input-directory', { describe: 'directory containing multiple istanbul coverage files', type: 'text', diff --git a/lib/commands/report.js b/lib/commands/report.js index 739ff30dc..345983d23 100644 --- a/lib/commands/report.js +++ b/lib/commands/report.js @@ -7,6 +7,7 @@ exports.describe = 'run coverage report for .nyc_output' exports.builder = function (yargs) { return yargs + .demandCommand(0, 0) .option('reporter', { alias: 'r', describe: 'coverage reporter(s) to use', diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 86937e7aa..10b57f9d0 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -49,7 +49,7 @@ t.test('--check-coverage fails when check-coverage command is used rather than f return testSuccess(t, { args: [process.execPath, './half-covered.js'] }).then(() => testFailure(t, { - args: ['check-coverage', '--lines', '51', process.execPath, './half-covered.js'] + args: ['check-coverage', '--lines', '51'] })) })