Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Remove deprecated "getOptions()" and "lib/cli/options.js" (#3967)

Juerg Ba3644c60b048
diff --git a/bin/options.js b/bin/options.js
deleted file mode 100644
index 102fd5a9..00000000
--- a/bin/options.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-/*
- * This module is deprecated and will be removed in a future version of Mocha.
- * @deprecated Deprecated in v6.0.0; source moved into {@link module:lib/cli/options lib/cli/options module}.
- * @module
- * @exports module:lib/cli/options
- */
-
-module.exports = require('../lib/cli/options');
diff --git a/lib/cli/options.js b/lib/cli/options.js
index a88dbfbf..7cd2e482 100644
--- a/lib/cli/options.js
+++ b/lib/cli/options.js
@@ -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');
@@ -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
diff --git a/package.json b/package.json
index d33830d3..07b81c9c 100644
--- a/package.json
+++ b/package.json
@@ -596,7 +596,7 @@
"watchify": "^3.11.1"
},
"files": [
- "bin/{*mocha,options.js}",
+ "bin/*mocha",
"assets/growl/*.png",
"lib/**/*.{js,html,json}",
"index.js",