Skip to content

Commit 741c4c7

Browse files
outsiderisplroebuck
authored andcommitted
Update "commander" to correct display of falsy default values (#3529)
Additionally, this includes minor updates to mocha's help output (by rewording text and/or specifying default values). These were then collected into the website documentation.
1 parent adb1f61 commit 741c4c7

File tree

4 files changed

+103
-79
lines changed

4 files changed

+103
-79
lines changed

bin/_mocha

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,17 @@ program
157157
.option('-f, --fgrep <string>', 'only run tests containing <string>')
158158
.option('-gc, --expose-gc', 'expose gc extension')
159159
.option('-i, --invert', 'inverts --grep and --fgrep matches')
160-
.option('-r, --require <name>', 'require the given module')
161-
.option('-s, --slow <ms>', '"slow" test threshold in milliseconds [75]')
162-
.option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]')
160+
.option('-r, --require <name>', 'require the given module', [])
161+
.option(
162+
'-s, --slow <ms>',
163+
'specify "slow" test threshold in milliseconds',
164+
75
165+
)
166+
.option(
167+
'-t, --timeout <ms>',
168+
'specify test timeout threshold in milliseconds',
169+
2000
170+
)
163171
.option(
164172
'-u, --ui <name>',
165173
`specify user-interface (${interfaceNames.join('|')})`,
@@ -204,7 +212,7 @@ program
204212
'--inspect-brk',
205213
'activate devtools in chrome and break on the first line'
206214
)
207-
.option('--interfaces', 'display available interfaces')
215+
.option('--interfaces', 'output provided interfaces and exit')
208216
.option('--no-deprecation', 'silence deprecation warnings')
209217
.option(
210218
'--exit',
@@ -218,10 +226,11 @@ program
218226
.option('--prof', 'log statistical profiling information')
219227
.option('--log-timer-events', 'Time events including external callbacks')
220228
.option('--recursive', 'include sub directories')
221-
.option('--reporters', 'display available reporters')
229+
.option('--reporters', 'output provided reporters and exit')
222230
.option(
223231
'--retries <times>',
224-
'set numbers of time to retry a failed test case'
232+
'specify number of times to retry a failed test case',
233+
0
225234
)
226235
.option(
227236
'--throw-deprecation',
@@ -246,11 +255,16 @@ program
246255
)
247256
.option(
248257
'--file <file>',
249-
'include a file to be ran during the suite',
258+
'adds file be loaded prior to suite execution',
250259
collect,
251260
[]
252261
)
253-
.option('--exclude <file>', 'a file or glob pattern to ignore', collect, []);
262+
.option(
263+
'--exclude <file>',
264+
'adds file or glob pattern to ignore',
265+
collect,
266+
[]
267+
);
254268

255269
program._name = 'mocha';
256270

docs/index.md

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -779,73 +779,71 @@ Mocha supports the `err.expected` and `err.actual` properties of any thrown `Ass
779779

780780
## Usage
781781

782-
```text
783-
Usage: mocha [debug] [options] [files]
784-
785-
Options:
786-
787-
-V, --version output the version number
788-
-A, --async-only force all tests to take a callback (async) or return a promise
789-
-c, --colors force enabling of colors
790-
-C, --no-colors force disabling of colors
791-
-G, --growl enable growl notification support
792-
-O, --reporter-options <k=v,k2=v2,...> reporter-specific options
793-
-R, --reporter <name> specify the reporter to use (default: spec)
794-
-S, --sort sort test files
795-
-b, --bail bail after first test failure
796-
-d, --debug enable node's debugger, synonym for node --debug
797-
-g, --grep <pattern> only run tests matching <pattern>
798-
-f, --fgrep <string> only run tests containing <string>
799-
-gc, --expose-gc expose gc extension
800-
-i, --invert inverts --grep and --fgrep matches
801-
-r, --require <name> require the given module
802-
-s, --slow <ms> "slow" test threshold in milliseconds [75]
803-
-t, --timeout <ms> set test-case timeout in milliseconds [2000]
804-
-u, --ui <name> specify user-interface (bdd|tdd|qunit|exports) (default: bdd)
805-
-w, --watch watch files in the current working directory for changes
806-
--check-leaks check for global variable leaks
807-
--full-trace display the full stack trace
808-
--compilers <ext>:<module>,... use the given module(s) to compile files (default: )
809-
--debug-brk enable node's debugger breaking on the first line
810-
--globals <names> allow the given comma-delimited global [names] (default: )
811-
--es_staging enable all staged features
812-
--harmony<_classes,_generators,...> all node --harmony* flags are available
813-
--preserve-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules
814-
--icu-data-dir include ICU data
815-
--inline-diffs display actual/expected differences inline within each string
816-
--no-diff do not show a diff on failure
817-
--inspect activate devtools in chrome
818-
--inspect-brk activate devtools in chrome and break on the first line
819-
--interfaces display available interfaces
820-
--no-deprecation silence deprecation warnings
821-
--exit force shutdown of the event loop after test run: mocha will call process.exit
822-
--no-timeouts disables timeouts, given implicitly with --debug
823-
--no-warnings silence all node process warnings
824-
--opts <path> specify opts path (default: test/mocha.opts)
825-
--perf-basic-prof enable perf linux profiler (basic support)
826-
--napi-modules enable experimental NAPI modules
827-
--prof log statistical profiling information
828-
--log-timer-events Time events including external callbacks
829-
--recursive include sub directories
830-
--reporters display available reporters
831-
--retries <times> set numbers of time to retry a failed test case
832-
--throw-deprecation throw an exception anytime a deprecated function is used
833-
--trace trace function calls
834-
--trace-deprecation show stack traces on deprecations
835-
--trace-warnings show stack traces on node process warnings
836-
--use_strict enforce strict mode
837-
--watch-extensions <ext>,... specify extensions to monitor with --watch (default: js)
838-
--delay wait for async suite definition
839-
--allow-uncaught enable uncaught errors to propagate
840-
--forbid-only causes test marked with only to fail the suite
841-
--forbid-pending causes pending tests and test marked with skip to fail the suite
842-
--file <file> include a file to be ran during the suite (default: )
843-
--exclude <file> a file or glob pattern to ignore (default: )
844-
-h, --help output usage information
845-
846-
Commands:
847-
848-
init <path> initialize a client-side mocha setup at <path>
782+
```console
783+
Usage: mocha [debug] [options] [files]
784+
785+
Options:
786+
-V, --version output the version number
787+
-A, --async-only force all tests to take a callback (async) or return a promise
788+
-c, --colors force enabling of colors
789+
-C, --no-colors force disabling of colors
790+
-G, --growl enable growl notification support
791+
-O, --reporter-options <k=v,k2=v2,...> reporter-specific options
792+
-R, --reporter <name> specify the reporter to use (default: "spec")
793+
-S, --sort sort test files
794+
-b, --bail bail after first test failure
795+
-d, --debug enable node's debugger, synonym for node --debug
796+
-g, --grep <pattern> only run tests matching <pattern>
797+
-f, --fgrep <string> only run tests containing <string>
798+
-gc, --expose-gc expose gc extension
799+
-i, --invert inverts --grep and --fgrep matches
800+
-r, --require <name> require the given module (default: [])
801+
-s, --slow <ms> specify "slow" test threshold in milliseconds (default: 75)
802+
-t, --timeout <ms> specify test timeout threshold in milliseconds (default: 2000)
803+
-u, --ui <name> specify user-interface (bdd|tdd|qunit|exports) (default: "bdd")
804+
-w, --watch watch files in the current working directory for changes
805+
--check-leaks check for global variable leaks
806+
--full-trace display the full stack trace
807+
--compilers <ext>:<module>,... use the given module(s) to compile files (default: [])
808+
--debug-brk enable node's debugger breaking on the first line
809+
--globals <names> allow the given comma-delimited global [names] (default: [])
810+
--es_staging enable all staged features
811+
--harmony<_classes,_generators,...> all node --harmony* flags are available
812+
--preserve-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules
813+
--icu-data-dir include ICU data
814+
--inline-diffs display actual/expected differences inline within each string
815+
--no-diff do not show a diff on failure
816+
--inspect activate devtools in chrome
817+
--inspect-brk activate devtools in chrome and break on the first line
818+
--interfaces output provided interfaces and exit
819+
--no-deprecation silence deprecation warnings
820+
--exit force shutdown of the event loop after test run: mocha will call process.exit
821+
--no-timeouts disables timeouts, given implicitly with --debug
822+
--no-warnings silence all node process warnings
823+
--opts <path> specify opts path (default: "test/mocha.opts")
824+
--perf-basic-prof enable perf linux profiler (basic support)
825+
--napi-modules enable experimental NAPI modules
826+
--prof log statistical profiling information
827+
--log-timer-events Time events including external callbacks
828+
--recursive include sub directories
829+
--reporters output provided reporters and exit
830+
--retries <times> specify number of times to retry a failed test case (default: 0)
831+
--throw-deprecation throw an exception anytime a deprecated function is used
832+
--trace trace function calls
833+
--trace-deprecation show stack traces on deprecations
834+
--trace-warnings show stack traces on node process warnings
835+
--use_strict enforce strict mode
836+
--watch-extensions <ext>,... specify extensions to monitor with --watch (default: ["js"])
837+
--delay wait for async suite definition
838+
--allow-uncaught enable uncaught errors to propagate
839+
--forbid-only causes test marked with only to fail the suite
840+
--forbid-pending causes pending tests and test marked with skip to fail the suite
841+
--file <file> adds file be loaded prior to suite execution (default: [])
842+
--exclude <file> adds file or glob pattern to ignore (default: [])
843+
-h, --help output usage information
844+
845+
Commands:
846+
init <path> initialize a client-side mocha setup at <path>
849847
```
850848

851849
### `-w, --watch`

package-lock.json

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@
461461
},
462462
"dependencies": {
463463
"browser-stdout": "1.3.1",
464-
"commander": "2.15.1",
464+
"commander": "2.19.0",
465465
"debug": "3.1.0",
466466
"diff": "3.5.0",
467467
"escape-string-regexp": "1.0.5",

0 commit comments

Comments
 (0)