Skip to content

Commit

Permalink
Merge cdcc756 into b269ad0
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Aug 1, 2019
2 parents b269ad0 + cdcc756 commit ce37b7a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/cli/options.js
Expand Up @@ -230,6 +230,9 @@ const loadMochaOpts = (args = {}) => {
// if there's an exception to catch here, I'm not sure what it is.
// by attaching the `no-opts` arg, we avoid re-parsing of `mocha.opts`.
if (mochaOpts) {
deprecate(
'Configuration via mocha.opts is DEPRECATED and will be removed from a future version of Mocha. Use RC files or package.json instead.'
);
result = parse(parseMochaOpts(mochaOpts));
debug(`${filepath} parsed succesfully`);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/run.js
Expand Up @@ -162,7 +162,7 @@ exports.builder = yargs =>
},
opts: {
default: defaults.opts,
description: 'Path to `mocha.opts`',
description: 'Path to `mocha.opts` (DEPRECATED)',
group: GROUPS.CONFIG,
normalize: true,
requiresArg: true
Expand Down
18 changes: 18 additions & 0 deletions test/integration/options/opts.spec.js
Expand Up @@ -10,6 +10,24 @@ describe('--opts', function() {
var args = [];
var fixture = path.join('options', 'opts');

it('should print a deprecation warning', function(done) {
var mochaOpts = path.join('test', 'opts', 'mocha.opts');
args = [resolvePath(fixture), '--opts', mochaOpts];
invokeMocha(
args,
function(err, res) {
if (err) {
return done(err);
}

expect(res, 'to have passed');
expect(res.output, 'to contain', 'mocha.opts is DEPRECATED');
done();
},
'pipe'
);
});

it('should work despite nonexistent default options file', function(done) {
args = [];
runMochaJSON(fixture, args, function(err, res) {
Expand Down

0 comments on commit ce37b7a

Please sign in to comment.