Skip to content

Commit 8f1c8d8

Browse files
feat: bump yargs to 17 (#5165)
* feat: bump yargs to 17 * fix: prefer coerced reporter-option for options * Aha, fix: process.exit() instead of process.exitCode * fix: --list-interfaces one-and-done conflict
1 parent 6caa902 commit 8f1c8d8

File tree

6 files changed

+181
-177
lines changed

6 files changed

+181
-177
lines changed

lib/cli/cli.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
const debug = require('debug')('mocha:cli:cli');
1414
const symbols = require('log-symbols');
15-
const yargs = require('yargs/yargs');
15+
const yargs = require('yargs');
1616
const path = require('path');
1717
const {
1818
loadRc,
@@ -63,15 +63,15 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
6363
debug('caught error sometime before command handler: %O', err);
6464
yargs.showHelp();
6565
console.error(`\n${symbols.error} ${ansi.red('ERROR:')} ${msg}`);
66-
process.exitCode = 1;
66+
process.exit(1);
6767
})
6868
.help('help', 'Show usage information & exit')
6969
.alias('help', 'h')
7070
.version('version', 'Show version number & exit', version)
7171
.alias('version', 'V')
7272
.wrap(process.stdout.columns ? Math.min(process.stdout.columns, 80) : 80)
7373
.epilog(
74-
`Mocha Resources
74+
`${ansi.reset("Mocha Resources")}
7575
Chat: ${ansi.magenta(discord)}
7676
GitHub: ${ansi.blue(repository.url)}
7777
Docs: ${ansi.yellow(homepage)}

lib/cli/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ exports.builder = yargs =>
169169
group: GROUPS.RULES
170170
},
171171
'list-interfaces': {
172-
conflicts: Array.from(ONE_AND_DONE_ARGS),
172+
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-interfaces"),
173173
description: 'List built-in user interfaces & exit'
174174
},
175175
'list-reporters': {
176-
conflicts: Array.from(ONE_AND_DONE_ARGS),
176+
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-reporters"),
177177
description: 'List built-in reporters & exit'
178178
},
179179
'no-colors': {

lib/mocha.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ function Mocha(options = {}) {
194194
.ui(options.ui)
195195
.reporter(
196196
options.reporter,
197-
options.reporterOption || options.reporterOptions // for backwards compatibility
197+
options['reporter-option'] ||
198+
options.reporterOption ||
199+
options.reporterOptions // for backwards compatibility
198200
)
199201
.slow(options.slow)
200202
.global(options.global);

0 commit comments

Comments
 (0)