diff --git a/lib/parse-args.js b/lib/parse-args.js index 84ff8e3e..033d72d6 100644 --- a/lib/parse-args.js +++ b/lib/parse-args.js @@ -13,7 +13,10 @@ function buildYargs (withCommands = false) { .options('config', { alias: 'c', config: true, - describe: 'path to JSON configuration file', + describe: 'path to JSON configuration file. By default, c8 searches for ' + + 'files named .c8rc, .c8rc.json, .nycrc, or .nycrc.json, ' + + 'starting from cwd and walking up the filesystem tree.', + defaultDescription: 'as described', configParser: (path) => { const config = JSON.parse(readFileSync(path)) return applyExtends(config, process.cwd(), true) @@ -41,10 +44,12 @@ function buildYargs (withCommands = false) { }) .options('src', { default: undefined, + defaultDescription: 'cwd', type: 'string', group: 'Reporting options', describe: 'supplying --src will override cwd as the default location where --all looks for src files. --src can be ' + - 'supplied multiple times and each directory will be included. This allows for workspaces spanning multiple projects' + 'supplied multiple times and each directory will be included. This allows for workspaces spanning multiple projects. ' + + 'Respects include/exclude.' }) .option('exclude-node-modules', { default: true, @@ -55,13 +60,18 @@ function buildYargs (withCommands = false) { alias: 'n', default: [], group: 'Reporting options', - describe: 'a list of specific files that should be covered (glob patterns are supported)' + describe: 'a list of specific files that should be covered (glob patterns are supported). ' + + 'Use multiple times on command line for multiple values. ' + + 'Respects exclude.' }) .option('exclude', { alias: 'x', default: defaultExclude, + defaultDescription: JSON.stringify(defaultExclude, undefined, ' '), group: 'Reporting options', - describe: 'a list of specific files and directories that should be excluded from coverage (glob patterns are supported)' + describe: 'a list of specific files and directories that should be excluded from coverage (glob patterns are supported). ' + + 'Use multiple times on command line for multiple values. ' + + 'Overrides include.' }) .option('extension', { alias: 'e', diff --git a/test/integration.js.snap b/test/integration.js.snap index fdbce704..2a449a32 100644 --- a/test/integration.js.snap +++ b/test/integration.js.snap @@ -156,7 +156,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.21 | 12.24 | 6.38 | 3.21 | +All files | 3.19 | 12.24 | 6.38 | 3.19 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -166,7 +166,7 @@ All files | 3.21 | 12.24 | 6.38 | 3.21 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - parse-args.js | 0 | 0 | 0 | 0 | 1-229 + parse-args.js | 0 | 0 | 0 | 0 | 1-239 report.js | 0 | 0 | 0 | 0 | 1-542 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 | @@ -522,7 +522,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.21 | 12.24 | 6.38 | 3.21 | +All files | 3.19 | 12.24 | 6.38 | 3.19 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -532,7 +532,7 @@ All files | 3.21 | 12.24 | 6.38 | 3.21 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - parse-args.js | 0 | 0 | 0 | 0 | 1-229 + parse-args.js | 0 | 0 | 0 | 0 | 1-239 report.js | 0 | 0 | 0 | 0 | 1-542 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 |