☕️ Classic, reliable, trusted test framework for Node.js and the browser
Revert "chore: cleanup references of --opts (#5402)" (#5404)
Mark Wiemer221ff727455a
diff --git a/.wallaby.js b/.wallaby.jsindex 9d5d4bf5..62573c2f 100644--- a/.wallaby.js+++ b/.wallaby.js@@ -16,6 +16,7 @@ module.exports = () => {instrument: false},'package.json',+ 'test/opts/mocha.opts','mocharc.yml','!lib/browser/growl.js'],diff --git a/lib/cli/run.js b/lib/cli/run.jsindex 73a98325..561592b9 100644--- a/lib/cli/run.js+++ b/lib/cli/run.js@@ -169,15 +169,11 @@ exports.builder = yargs =>group: GROUPS.RULES},'list-interfaces': {- conflicts: Array.from(ONE_AND_DONE_ARGS).filter(- arg => arg !== 'list-interfaces'- ),+ 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).filter(- arg => arg !== 'list-reporters'- ),+ conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-reporters"),description: 'List built-in reporters & exit'},'no-colors': {@@ -200,8 +196,7 @@ exports.builder = yargs =>group: GROUPS.RULES},'posix-exit-codes': {- description:- "Use POSIX and UNIX shell exit codes as Mocha's return value",+ description: 'Use POSIX and UNIX shell exit codes as Mocha\'s return value',group: GROUPS.RULES},recursive: {@@ -347,6 +342,13 @@ exports.builder = yargs =>);}+ if (argv.opts) {+ throw createUnsupportedError(+ `--opts: configuring Mocha via 'mocha.opts' is DEPRECATED and no longer supported.+ Please use a configuration file instead.`+ );+ }+return true;}).middleware(async (argv, yargs) => {diff --git a/test/integration/options/opts.spec.js b/test/integration/options/opts.spec.jsnew file mode 100644index 00000000..d66db406--- /dev/null+++ b/test/integration/options/opts.spec.js@@ -0,0 +1,23 @@+'use strict';++var invokeMocha = require('../helpers').invokeMocha;++describe('--opts', function () {+ it('should report deprecation', function (done) {+ invokeMocha(+ ['--opts', './test/mocha.opts'],+ function (err, res) {+ if (err) {+ return done(err);+ }+ expect(+ res,+ 'to have failed with output',+ /'mocha.opts' is DEPRECATED/i+ );+ done();+ },+ 'pipe'+ );+ });+});