Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve --help #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lib/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions test/integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down