From 741c4c794c89f9cf7c590e8c220c8c16162c0465 Mon Sep 17 00:00:00 2001 From: "JeongHoon Byun (aka Outsider)" Date: Fri, 26 Oct 2018 22:56:13 -0700 Subject: [PATCH] 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. --- bin/_mocha | 30 ++++++++--- docs/index.md | 132 +++++++++++++++++++++++----------------------- package-lock.json | 18 +++++-- package.json | 2 +- 4 files changed, 103 insertions(+), 79 deletions(-) diff --git a/bin/_mocha b/bin/_mocha index 41e9871b76..355a91b83c 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -157,9 +157,17 @@ program .option('-f, --fgrep ', 'only run tests containing ') .option('-gc, --expose-gc', 'expose gc extension') .option('-i, --invert', 'inverts --grep and --fgrep matches') - .option('-r, --require ', 'require the given module') - .option('-s, --slow ', '"slow" test threshold in milliseconds [75]') - .option('-t, --timeout ', 'set test-case timeout in milliseconds [2000]') + .option('-r, --require ', 'require the given module', []) + .option( + '-s, --slow ', + 'specify "slow" test threshold in milliseconds', + 75 + ) + .option( + '-t, --timeout ', + 'specify test timeout threshold in milliseconds', + 2000 + ) .option( '-u, --ui ', `specify user-interface (${interfaceNames.join('|')})`, @@ -204,7 +212,7 @@ program '--inspect-brk', 'activate devtools in chrome and break on the first line' ) - .option('--interfaces', 'display available interfaces') + .option('--interfaces', 'output provided interfaces and exit') .option('--no-deprecation', 'silence deprecation warnings') .option( '--exit', @@ -218,10 +226,11 @@ program .option('--prof', 'log statistical profiling information') .option('--log-timer-events', 'Time events including external callbacks') .option('--recursive', 'include sub directories') - .option('--reporters', 'display available reporters') + .option('--reporters', 'output provided reporters and exit') .option( '--retries ', - 'set numbers of time to retry a failed test case' + 'specify number of times to retry a failed test case', + 0 ) .option( '--throw-deprecation', @@ -246,11 +255,16 @@ program ) .option( '--file ', - 'include a file to be ran during the suite', + 'adds file be loaded prior to suite execution', collect, [] ) - .option('--exclude ', 'a file or glob pattern to ignore', collect, []); + .option( + '--exclude ', + 'adds file or glob pattern to ignore', + collect, + [] + ); program._name = 'mocha'; diff --git a/docs/index.md b/docs/index.md index 5fae36b634..367dba678b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -779,73 +779,71 @@ Mocha supports the `err.expected` and `err.actual` properties of any thrown `Ass ## Usage -```text - Usage: mocha [debug] [options] [files] - - Options: - - -V, --version output the version number - -A, --async-only force all tests to take a callback (async) or return a promise - -c, --colors force enabling of colors - -C, --no-colors force disabling of colors - -G, --growl enable growl notification support - -O, --reporter-options reporter-specific options - -R, --reporter specify the reporter to use (default: spec) - -S, --sort sort test files - -b, --bail bail after first test failure - -d, --debug enable node's debugger, synonym for node --debug - -g, --grep only run tests matching - -f, --fgrep only run tests containing - -gc, --expose-gc expose gc extension - -i, --invert inverts --grep and --fgrep matches - -r, --require require the given module - -s, --slow "slow" test threshold in milliseconds [75] - -t, --timeout set test-case timeout in milliseconds [2000] - -u, --ui specify user-interface (bdd|tdd|qunit|exports) (default: bdd) - -w, --watch watch files in the current working directory for changes - --check-leaks check for global variable leaks - --full-trace display the full stack trace - --compilers :,... use the given module(s) to compile files (default: ) - --debug-brk enable node's debugger breaking on the first line - --globals allow the given comma-delimited global [names] (default: ) - --es_staging enable all staged features - --harmony<_classes,_generators,...> all node --harmony* flags are available - --preserve-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules - --icu-data-dir include ICU data - --inline-diffs display actual/expected differences inline within each string - --no-diff do not show a diff on failure - --inspect activate devtools in chrome - --inspect-brk activate devtools in chrome and break on the first line - --interfaces display available interfaces - --no-deprecation silence deprecation warnings - --exit force shutdown of the event loop after test run: mocha will call process.exit - --no-timeouts disables timeouts, given implicitly with --debug - --no-warnings silence all node process warnings - --opts specify opts path (default: test/mocha.opts) - --perf-basic-prof enable perf linux profiler (basic support) - --napi-modules enable experimental NAPI modules - --prof log statistical profiling information - --log-timer-events Time events including external callbacks - --recursive include sub directories - --reporters display available reporters - --retries set numbers of time to retry a failed test case - --throw-deprecation throw an exception anytime a deprecated function is used - --trace trace function calls - --trace-deprecation show stack traces on deprecations - --trace-warnings show stack traces on node process warnings - --use_strict enforce strict mode - --watch-extensions ,... specify extensions to monitor with --watch (default: js) - --delay wait for async suite definition - --allow-uncaught enable uncaught errors to propagate - --forbid-only causes test marked with only to fail the suite - --forbid-pending causes pending tests and test marked with skip to fail the suite - --file include a file to be ran during the suite (default: ) - --exclude a file or glob pattern to ignore (default: ) - -h, --help output usage information - - Commands: - - init initialize a client-side mocha setup at +```console +Usage: mocha [debug] [options] [files] + +Options: + -V, --version output the version number + -A, --async-only force all tests to take a callback (async) or return a promise + -c, --colors force enabling of colors + -C, --no-colors force disabling of colors + -G, --growl enable growl notification support + -O, --reporter-options reporter-specific options + -R, --reporter specify the reporter to use (default: "spec") + -S, --sort sort test files + -b, --bail bail after first test failure + -d, --debug enable node's debugger, synonym for node --debug + -g, --grep only run tests matching + -f, --fgrep only run tests containing + -gc, --expose-gc expose gc extension + -i, --invert inverts --grep and --fgrep matches + -r, --require require the given module (default: []) + -s, --slow specify "slow" test threshold in milliseconds (default: 75) + -t, --timeout specify test timeout threshold in milliseconds (default: 2000) + -u, --ui specify user-interface (bdd|tdd|qunit|exports) (default: "bdd") + -w, --watch watch files in the current working directory for changes + --check-leaks check for global variable leaks + --full-trace display the full stack trace + --compilers :,... use the given module(s) to compile files (default: []) + --debug-brk enable node's debugger breaking on the first line + --globals allow the given comma-delimited global [names] (default: []) + --es_staging enable all staged features + --harmony<_classes,_generators,...> all node --harmony* flags are available + --preserve-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules + --icu-data-dir include ICU data + --inline-diffs display actual/expected differences inline within each string + --no-diff do not show a diff on failure + --inspect activate devtools in chrome + --inspect-brk activate devtools in chrome and break on the first line + --interfaces output provided interfaces and exit + --no-deprecation silence deprecation warnings + --exit force shutdown of the event loop after test run: mocha will call process.exit + --no-timeouts disables timeouts, given implicitly with --debug + --no-warnings silence all node process warnings + --opts specify opts path (default: "test/mocha.opts") + --perf-basic-prof enable perf linux profiler (basic support) + --napi-modules enable experimental NAPI modules + --prof log statistical profiling information + --log-timer-events Time events including external callbacks + --recursive include sub directories + --reporters output provided reporters and exit + --retries specify number of times to retry a failed test case (default: 0) + --throw-deprecation throw an exception anytime a deprecated function is used + --trace trace function calls + --trace-deprecation show stack traces on deprecations + --trace-warnings show stack traces on node process warnings + --use_strict enforce strict mode + --watch-extensions ,... specify extensions to monitor with --watch (default: ["js"]) + --delay wait for async suite definition + --allow-uncaught enable uncaught errors to propagate + --forbid-only causes test marked with only to fail the suite + --forbid-pending causes pending tests and test marked with skip to fail the suite + --file adds file be loaded prior to suite execution (default: []) + --exclude adds file or glob pattern to ignore (default: []) + -h, --help output usage information + +Commands: + init initialize a client-side mocha setup at ``` ### `-w, --watch` diff --git a/package-lock.json b/package-lock.json index 782bb42830..97fdde53a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2026,9 +2026,9 @@ } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" }, "comment-regex": { "version": "1.0.1", @@ -5939,6 +5939,12 @@ "uglify-js": "3.3.x" }, "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -17954,6 +17960,12 @@ "source-map": "~0.6.1" }, "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/package.json b/package.json index 002b55e32b..5cd30f5a17 100644 --- a/package.json +++ b/package.json @@ -461,7 +461,7 @@ }, "dependencies": { "browser-stdout": "1.3.1", - "commander": "2.15.1", + "commander": "2.19.0", "debug": "3.1.0", "diff": "3.5.0", "escape-string-regexp": "1.0.5",