From 381c3d75f2779ce8b1da8b122043c1005f68f09b Mon Sep 17 00:00:00 2001 From: Mark Wiemer Date: Wed, 1 Oct 2025 17:01:23 -0700 Subject: [PATCH] Reapply "chore: cleanup references of --opts (#5402)" (#5404) This reverts commit 221ff727455ab8a1ff69c0734c15ac9a187da594. --- .wallaby.js | 1 - lib/cli/run.js | 18 ++++++++---------- test/integration/options/opts.spec.js | 23 ----------------------- 3 files changed, 8 insertions(+), 34 deletions(-) delete mode 100644 test/integration/options/opts.spec.js diff --git a/.wallaby.js b/.wallaby.js index 62573c2f97..9d5d4bf5fe 100644 --- a/.wallaby.js +++ b/.wallaby.js @@ -16,7 +16,6 @@ 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.js index 561592b916..73a9832500 100644 --- a/lib/cli/run.js +++ b/lib/cli/run.js @@ -169,11 +169,15 @@ 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': { @@ -196,7 +200,8 @@ 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: { @@ -342,13 +347,6 @@ 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.js deleted file mode 100644 index d66db40603..0000000000 --- a/test/integration/options/opts.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -'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' - ); - }); -});