Skip to content

Commit e654253

Browse files
committed
update yargs; closes #3742
1 parent b27bc60 commit e654253

4 files changed

Lines changed: 186 additions & 110 deletions

File tree

lib/cli/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const debug = require('debug')('mocha:cli:cli');
1313
const symbols = require('log-symbols');
1414
const yargs = require('yargs');
1515
const path = require('path');
16-
const {loadOptions} = require('./options');
16+
const {loadOptions, YARGS_PARSER_CONFIG} = require('./options');
1717
const commands = require('./commands');
1818
const ansi = require('ansi-colors');
1919
const {repository, homepage, version, gitter} = require('../../package.json');
@@ -59,6 +59,7 @@ exports.main = (argv = process.argv.slice(2)) => {
5959
Docs: ${ansi.yellow(homepage)}
6060
`
6161
)
62+
.parserConfiguration(YARGS_PARSER_CONFIG)
6263
.parse(argv, loadOptions(argv));
6364
};
6465

lib/cli/options.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const yargsParser = require('yargs-parser');
1111
const {types, aliases} = require('./run-option-metadata');
1212
const {ONE_AND_DONE_ARGS} = require('./one-and-dones');
1313
const mocharc = require('../mocharc.json');
14-
const yargsParserConfig = require('../../package.json').yargs;
1514
const {list} = require('./run-helpers');
1615
const {loadConfig, findConfig} = require('./config');
1716
const findup = require('findup-sync');
@@ -32,6 +31,16 @@ const {isNodeFlag} = require('./node-flags');
3231
* @interface Arguments
3332
*/
3433

34+
/**
35+
* Base yargs parser configuration
36+
* @private
37+
*/
38+
const YARGS_PARSER_CONFIG = {
39+
'combine-arrays': true,
40+
'short-option-groups': false,
41+
'dot-notation': false
42+
};
43+
3544
/**
3645
* This is the config pulled from the `yargs` property of Mocha's
3746
* `package.json`, but it also disables camel case expansion as to
@@ -40,7 +49,7 @@ const {isNodeFlag} = require('./node-flags');
4049
* @private
4150
* @ignore
4251
*/
43-
const configuration = Object.assign({}, yargsParserConfig, {
52+
const configuration = Object.assign({}, YARGS_PARSER_CONFIG, {
4453
'camel-case-expansion': false
4554
});
4655

@@ -335,3 +344,4 @@ const loadOptions = (argv = []) => {
335344
};
336345

337346
module.exports.loadOptions = loadOptions;
347+
module.exports.YARGS_PARSER_CONFIG = YARGS_PARSER_CONFIG;

0 commit comments

Comments
 (0)