Skip to content

Commit

Permalink
Remove deprecated "getOptions()" and "lib/cli/options.js" (#3967)
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Aug 19, 2019
1 parent fafa9b9 commit a3644c6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 46 deletions.
10 changes: 0 additions & 10 deletions bin/options.js

This file was deleted.

35 changes: 0 additions & 35 deletions lib/cli/options.js
Expand Up @@ -15,7 +15,6 @@ const mocharc = require('../mocharc.json');
const {list} = require('./run-helpers');
const {loadConfig, findConfig} = require('./config');
const findUp = require('find-up');
const {deprecate} = require('../utils');
const debug = require('debug')('mocha:cli:options');
const {isNodeFlag} = require('./node-flags');

Expand Down Expand Up @@ -163,40 +162,6 @@ const parseMochaOpts = content =>
.filter(Boolean)
.map(value => value.replace(/%20/g, ' '));

/**
* Prepends options from run-control file to the command line arguments.
*
* @deprecated Deprecated in v6.0.0; This function is no longer used internally and will be removed in a future version.
* @public
* @alias module:lib/cli/options
* @see {@link https://mochajs.org/#mochaopts|mocha.opts}
*/
module.exports = function getOptions() {
deprecate(
'getOptions() is DEPRECATED and will be removed from a future version of Mocha. Use loadOptions() instead'
);
if (process.argv.length === 3 && ONE_AND_DONE_ARGS.has(process.argv[2])) {
return;
}

const optsPath =
process.argv.indexOf('--opts') === -1
? mocharc.opts
: process.argv[process.argv.indexOf('--opts') + 1];

try {
const options = parseMochaOpts(fs.readFileSync(optsPath, 'utf8'));

process.argv = process.argv
.slice(0, 2)
.concat(options.concat(process.argv.slice(2)));
} catch (ignore) {
// NOTE: should console.error() and throw the error
}

process.env.LOADED_MOCHA_OPTS = true;
};

/**
* Given filepath in `args.opts`, attempt to load and parse a `mocha.opts` file.
* @param {Object} [args] - Arguments object
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -596,7 +596,7 @@
"watchify": "^3.11.1"
},
"files": [
"bin/{*mocha,options.js}",
"bin/*mocha",
"assets/growl/*.png",
"lib/**/*.{js,html,json}",
"index.js",
Expand Down

0 comments on commit a3644c6

Please sign in to comment.