Socket
Socket
Sign inDemoInstall

mocha

Package Overview
Dependencies
Maintainers
4
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha - npm Package Compare versions

Comparing version 8.1.2 to 8.1.3

lib/nodejs/file-unloader.js

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 8.1.3 / 2020-08-28
## :bug: Fixes
- [#4425](https://github.com/mochajs/mocha/issues/4425): Restore `Mocha.utils.lookupFiles()` and Webpack compatibility (both broken since v8.1.0); `Mocha.utils.lookupFiles()` is now **deprecated** and will be removed in the next major revision of Mocha; use `require('mocha/lib/cli').lookupFiles` instead ([**@boneskull**](https://github.com/boneskull))
# 8.1.2 / 2020-08-25

@@ -2,0 +8,0 @@

27

lib/cli/cli.js

@@ -6,8 +6,7 @@ #!/usr/bin/env node

/**
* This is where we finally parse and handle arguments passed to the `mocha` executable.
* Option parsing is handled by {@link https://npm.im/yargs yargs}.
* If executed via `node`, this module will run {@linkcode module:lib/cli/cli.main main()}.
*
* @private
* @module
* Contains CLI entry point and public API for programmatic usage in Node.js.
* - Option parsing is handled by {@link https://npm.im/yargs yargs}.
* - If executed via `node`, this module will run {@linkcode module:lib/cli.main main()}.
* @public
* @module lib/cli
*/

@@ -19,3 +18,9 @@

const path = require('path');
const {loadOptions, YARGS_PARSER_CONFIG} = require('./options');
const {
loadRc,
loadPkgRc,
loadOptions,
YARGS_PARSER_CONFIG
} = require('./options');
const lookupFiles = require('./lookup-files');
const commands = require('./commands');

@@ -30,3 +35,4 @@ const ansi = require('ansi-colors');

* - Sets {@linkcode https://nodejs.org/api/errors.html#errors_error_stacktracelimit Error.stackTraceLimit} to `Infinity`
* @summary Mocha's main entry point from the command-line.
* @public
* @summary Mocha's main command-line entry-point.
* @param {string[]} argv - Array of arguments to parse, or by default the lovely `process.argv.slice(2)`

@@ -77,2 +83,7 @@ */

exports.lookupFiles = lookupFiles;
exports.loadOptions = loadOptions;
exports.loadPkgRc = loadPkgRc;
exports.loadRc = loadRc;
// allow direct execution

@@ -79,0 +90,0 @@ if (require.main === module) {

'use strict';
/**
* Just exports {@link module:lib/cli/cli} for convenience.
* @private
* @module lib/cli
* @exports module:lib/cli/cli
*/
module.exports = require('./cli');
'use strict';
/**
* Contains `lookupFiles`, which takes some globs/dirs/options and returns a list of files.
* @module
* @private
*/
var fs = require('fs');

@@ -56,3 +62,3 @@ var path = require('path');

* @public
* @memberof Mocha.utils
* @alias module:lib/cli.lookupFiles
* @param {string} filepath - Base path to start searching from.

@@ -59,0 +65,0 @@ * @param {string[]} [extensions=[]] - File extensions to look for.

@@ -6,3 +6,4 @@ 'use strict';

* whether that's a config file or `package.json` or whatever.
* @module
* @module lib/cli/options
* @private
*/

@@ -154,3 +155,3 @@

* @public
* @memberof module:lib/cli/options
* @alias module:lib/cli.loadRc
* @returns {external:yargsParser.Arguments|void} Parsed config, or nothing if `args.config` is `false`

@@ -172,3 +173,3 @@ */

* @public
* @memberof module:lib/cli/options
* @alias module:lib/cli.loadPkgRc
* @returns {external:yargsParser.Arguments|void} Parsed config, or nothing if `args.package` is `false`

@@ -216,3 +217,3 @@ */

* @public
* @memberof module:lib/cli/options
* @alias module:lib/cli.loadOptions
* @returns {external:yargsParser.Arguments} Parsed args from everything

@@ -219,0 +220,0 @@ */

@@ -15,3 +15,2 @@ 'use strict';

var mocharc = require('./mocharc.json');
var errors = require('./errors');
var Suite = require('./suite');

@@ -22,8 +21,9 @@ var esmUtils = utils.supportsEsModules(true)

var createStatsCollector = require('./stats-collector');
var createInvalidReporterError = errors.createInvalidReporterError;
var createInvalidInterfaceError = errors.createInvalidInterfaceError;
var createMochaInstanceAlreadyDisposedError =
errors.createMochaInstanceAlreadyDisposedError;
var createMochaInstanceAlreadyRunningError =
errors.createMochaInstanceAlreadyRunningError;
const {
createUnsupportedError,
createInvalidInterfaceError,
createInvalidReporterError,
createMochaInstanceAlreadyDisposedError,
createMochaInstanceAlreadyRunningError
} = require('./errors');
var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;

@@ -450,3 +450,8 @@ var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;

Mocha.unloadFile = function(file) {
delete require.cache[require.resolve(file)];
if (utils.isBrowser()) {
throw createUnsupportedError(
'unloadFile() is only suported in a Node.js environment'
);
}
return require('./nodejs/file-unloader').unloadFile(file);
};

@@ -1057,5 +1062,3 @@

if (utils.isBrowser()) {
throw errors.createUnsupportedError(
'parallel mode is only supported in Node.js'
);
throw createUnsupportedError('parallel mode is only supported in Node.js');
}

@@ -1071,3 +1074,3 @@ var parallel = enable === true;

if (this._state !== mochaStates.INIT) {
throw errors.createUnsupportedError(
throw createUnsupportedError(
'cannot change parallel mode after having called run()'

@@ -1074,0 +1077,0 @@ );

@@ -648,1 +648,30 @@ 'use strict';

};
/**
* Lookup file names at the given `path`.
*
* @description
* Filenames are returned in _traversal_ order by the OS/filesystem.
* **Make no assumption that the names will be sorted in any fashion.**
*
* @public
* @alias module:lib/cli.lookupFiles
* @param {string} filepath - Base path to start searching from.
* @param {string[]} [extensions=[]] - File extensions to look for.
* @param {boolean} [recursive=false] - Whether to recurse into subdirectories.
* @return {string[]} An array of paths.
* @throws {Error} if no files match pattern.
* @throws {TypeError} if `filepath` is directory and `extensions` not provided.
* @deprecated Moved to {@link module:lib/cli.lookupFiles}
*/
exports.lookupFiles = (...args) => {
if (exports.isBrowser()) {
throw require('./errors').createUnsupportedError(
'lookupFiles() is only supported in Node.js!'
);
}
exports.deprecate(
'`lookupFiles()` in module `mocha/lib/utils` has moved to module `mocha/lib/cli` and will be removed in the next major revision of Mocha'
);
return require('./cli').lookupFiles(...args);
};
{
"name": "mocha",
"version": "8.1.2",
"version": "8.1.3",
"description": "simple, flexible, fun test framework",

@@ -84,3 +84,3 @@ "keywords": [

"@babel/preset-env": "^7.11.0",
"@mocha/docdash": "^3.0.0",
"@mocha/docdash": "^3.0.1",
"@rollup/plugin-babel": "^5.1.0",

@@ -111,2 +111,3 @@ "@rollup/plugin-commonjs": "^14.0.0",

"eslint-plugin-standard": "^4.0.1",
"fail-on-errors-webpack-plugin": "^3.0.0",
"fs-extra": "^9.0.1",

@@ -155,3 +156,5 @@ "husky": "^4.2.5",

"uuid": "^8.3.0",
"watchify": "^3.11.1"
"watchify": "^3.11.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
},

@@ -179,3 +182,5 @@ "files": [

"./lib/nodejs/parallel-buffered-runner.js": false,
"./lib/nodejs/reporters/parallel-buffered.js": false
"./lib/nodejs/reporters/parallel-buffered.js": false,
"./lib/nodejs/file-unloader.js": false,
"./lib/cli/index.js": false
},

@@ -182,0 +187,0 @@ "prettier": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc