Skip to content

Commit 993853e

Browse files
authored
Make sure mocha -h consistently shows help
Previously, having options in `test/mocha.opts` would add those to `process.argv` to be passed to `program.parse`, which would make it stop showing help. Fixes #2745
1 parent b4ebabd commit 993853e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bin/options.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ module.exports = getOptions;
1717
*/
1818

1919
function getOptions () {
20+
if (process.argv.length === 3 && (process.argv[2] === '-h' || process.argv[2] === '--help')) {
21+
return;
22+
}
23+
2024
var optsPath = process.argv.indexOf('--opts') === -1
2125
? 'test/mocha.opts'
2226
: process.argv[process.argv.indexOf('--opts') + 1];

0 commit comments

Comments
 (0)