Repository: mochajs/mocha

Problem statement:
🔒 Security: Upgrade yargs-parser and yargs to latest stable version
Currently the mocha@10.0.0 version has not upgraded its yarg-parser and yargs which is causing a security vulnerability  (NO-CVE: Regular Expression Denial Of Service (ReDoS)) . Please help upgrade both to the most stable version as of current date. Thank you . Attached are the vulnerability and the most stable release in the npm package library
![image](https://user-images.githubusercontent.com/109644072/179895841-a95810b7-dc70-45e4-9886-98cdc58efe6f.png)
![image](https://user-images.githubusercontent.com/109644072/179895952-0c16c07f-acb3-4bce-bce9-11bb65914235.png)



Hints:
Snyk scan is also flagging Mocha ReDos as a High Risk Vulnerability:
https://security.snyk.io/vuln/SNYK-JS-MOCHA-2863123.
This issue hasn't had any recent activity, and I'm labeling it `stale`. Remove the label or comment or this issue will be closed in 14 days. Thanks for contributing to Mocha!
See also #4938 and #4809
This issue hasn't had any recent activity, and I'm labeling it `stale`. Remove the label or comment or this issue will be closed in 14 days. Thanks for contributing to Mocha!
Any news about updating yargs-* to latest stable version?
This issue hasn't had any recent activity, and I'm labeling it `stale`. Remove the label or comment or this issue will be closed in 14 days. Thanks for contributing to Mocha!
Any news about updating yargs-* to latest stable version?
Marking as accepting PRs. Note that Mocha's current major version supports Node 14, so any version of a new package must also support 14.

Patch:
diff --git a/lib/cli/cli.js b/lib/cli/cli.js
--- a/lib/cli/cli.js
+++ b/lib/cli/cli.js
@@ -12,7 +12,7 @@
 
 const debug = require('debug')('mocha:cli:cli');
 const symbols = require('log-symbols');
-const yargs = require('yargs/yargs');
+const yargs = require('yargs');
 const path = require('path');
 const {
   loadRc,
@@ -63,7 +63,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
       debug('caught error sometime before command handler: %O', err);
       yargs.showHelp();
       console.error(`\n${symbols.error} ${ansi.red('ERROR:')} ${msg}`);
-      process.exitCode = 1;
+      process.exit(1);
     })
     .help('help', 'Show usage information & exit')
     .alias('help', 'h')
@@ -71,7 +71,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
     .alias('version', 'V')
     .wrap(process.stdout.columns ? Math.min(process.stdout.columns, 80) : 80)
     .epilog(
-      `Mocha Resources
+      `${ansi.reset("Mocha Resources")}
     Chat: ${ansi.magenta(discord)}
   GitHub: ${ansi.blue(repository.url)}
     Docs: ${ansi.yellow(homepage)}
diff --git a/lib/cli/run.js b/lib/cli/run.js
--- a/lib/cli/run.js
+++ b/lib/cli/run.js
@@ -169,11 +169,11 @@ exports.builder = yargs =>
         group: GROUPS.RULES
       },
       'list-interfaces': {
-        conflicts: Array.from(ONE_AND_DONE_ARGS),
+        conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-interfaces"),
         description: 'List built-in user interfaces & exit'
       },
       'list-reporters': {
-        conflicts: Array.from(ONE_AND_DONE_ARGS),
+        conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-reporters"),
         description: 'List built-in reporters & exit'
       },
       'no-colors': {
diff --git a/lib/mocha.js b/lib/mocha.js
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -194,7 +194,9 @@ function Mocha(options = {}) {
     .ui(options.ui)
     .reporter(
       options.reporter,
-      options.reporterOption || options.reporterOptions // for backwards compatibility
+      options['reporter-option'] ||
+        options.reporterOption ||
+        options.reporterOptions // for backwards compatibility
     )
     .slow(options.slow)
     .global(options.global);


Test patch:
diff --git a/test/node-unit/cli/run.spec.js b/test/node-unit/cli/run.spec.js
--- a/test/node-unit/cli/run.spec.js
+++ b/test/node-unit/cli/run.spec.js
@@ -7,7 +7,7 @@ describe('command', function () {
   describe('run', function () {
     describe('builder', function () {
       const IGNORED_OPTIONS = new Set(['help', 'version']);
-      const options = builder(require('yargs/yargs')().reset()).getOptions();
+      const options = builder(require('yargs')()).getOptions();
       ['number', 'string', 'boolean', 'array'].forEach(type => {
         describe(`${type} type`, function () {
           Array.from(new Set(options[type])).forEach(option => {