Skip to content

Commit

Permalink
exit upon --opts option
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Feb 27, 2020
1 parent bd4850e commit 7cfbf80
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/cli/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,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.`
);
}

// load requires first, because it can impact "plugin" validation
handleRequires(argv.require);
validatePlugin(argv, 'reporter', Mocha.reporters);
Expand Down
23 changes: 23 additions & 0 deletions test/integration/options/opts.spec.js
Original file line number Diff line number Diff line change
@@ -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'
);
});
});

0 comments on commit 7cfbf80

Please sign in to comment.