Skip to content

Commit

Permalink
Make sure mocha -h consistently shows help
Browse files Browse the repository at this point in the history
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 mochajs#2745
  • Loading branch information
Zarel committed Jun 14, 2017
1 parent 7647e18 commit 0bfd2e6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/options.js
Expand Up @@ -17,6 +17,10 @@ module.exports = getOptions;
*/

function getOptions () {
if (process.argv.length === 3 && (process.argv[2] === '-h' || process.argv[2] === '--help')) {
return;
}

var optsPath = process.argv.indexOf('--opts') === -1
? 'test/mocha.opts'
: process.argv[process.argv.indexOf('--opts') + 1];
Expand Down

0 comments on commit 0bfd2e6

Please sign in to comment.