From 0bfd2e6bc8387265f96c711be8fe9a6b750d43a3 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Fri, 17 Mar 2017 13:16:28 -0500 Subject: [PATCH] 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 --- bin/options.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/options.js b/bin/options.js index be5a60c9c3..7ee0eca8dc 100644 --- a/bin/options.js +++ b/bin/options.js @@ -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];