Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mocha

Package Overview
Dependencies
Maintainers
4
Versions
202
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.2.0 to 8.2.1

13

CHANGELOG.md

@@ -1,3 +0,14 @@

# 8.2.0 / 2020-10-15
# 8.2.1 / 2020-11-02
Fixed stuff.
## :bug: Fixes
- [#4489](https://github.com/mochajs/mocha/issues/4489): Fix problematic handling of otherwise-unhandled `Promise` rejections and erroneous "`done()` called twice" errors ([**@boneskull**](https://github.com/boneskull))
- [#4496](https://github.com/mochajs/mocha/issues/4496): Avoid `MaxListenersExceededWarning` in watch mode ([**@boneskull**](https://github.com/boneskull))
Also thanks to [**@akeating**](https://github.com/akeating) for a documentation fix!
# 8.2.0 / 2020-10-16
The major feature added in v8.2.0 is addition of support for [_global fixtures_](https://mochajs.org/#global-fixtures).

@@ -4,0 +15,0 @@

@@ -44,2 +44,5 @@ 'use strict';

// ensure we aren't leaking event listeners
mocha.dispose();
// this `require` is needed because the require cache has been cleared. the dynamic

@@ -104,2 +107,5 @@ // exports set via the below call to `mocha.ui()` won't work properly if a

// ensure we aren't leaking event listeners
mocha.dispose();
// this `require` is needed because the require cache has been cleared. the dynamic

@@ -106,0 +112,0 @@ // exports set via the below call to `mocha.ui()` won't work properly if a

@@ -132,2 +132,4 @@ 'use strict';

const MOCHA_ERRORS = new Set(Object.values(constants));
/**

@@ -423,2 +425,12 @@ * Creates an error object to be thrown when no files to be tested could be found using specified pattern.

/**
* Returns `true` if an error came out of Mocha.
* _Can suffer from false negatives, but not false positives._
* @public
* @param {*} err - Error, or anything
* @returns {boolean}
*/
const isMochaError = err =>
Boolean(err && typeof err === 'object' && MOCHA_ERRORS.has(err.code));
module.exports = {

@@ -444,3 +456,4 @@ constants,

deprecate,
isMochaError,
warn
};

44

lib/runner.js

@@ -27,6 +27,9 @@ 'use strict';

var errors = require('./errors');
var createInvalidExceptionError = errors.createInvalidExceptionError;
var createUnsupportedError = errors.createUnsupportedError;
var createFatalError = errors.createFatalError;
const {
createInvalidExceptionError,
createUnsupportedError,
createFatalError,
isMochaError,
constants: errorConstants
} = require('./errors');

@@ -183,2 +186,25 @@ /**

this.uncaught = this._uncaught.bind(this);
this.unhandled = (reason, promise) => {
if (isMochaError(reason)) {
debug(
'trapped unhandled rejection coming out of Mocha; forwarding to uncaught handler:',
reason
);
this.uncaught(reason);
} else {
debug(
'trapped unhandled rejection from (probably) user code; re-emitting on process'
);
this._removeEventListener(
process,
'unhandledRejection',
this.unhandled
);
try {
process.emit('unhandledRejection', reason, promise);
} finally {
this._addEventListener(process, 'unhandledRejection', this.unhandled);
}
}
};
}

@@ -419,3 +445,3 @@ }

if (this.state === constants.STATE_STOPPED) {
if (err.code === errors.constants.MULTIPLE_DONE) {
if (err.code === errorConstants.MULTIPLE_DONE) {
throw err;

@@ -1031,5 +1057,3 @@ }

this.runSuite(rootSuite, async () => {
end();
});
this.runSuite(rootSuite, end);
};

@@ -1068,5 +1092,5 @@

this._removeEventListener(process, 'uncaughtException', this.uncaught);
this._removeEventListener(process, 'unhandledRejection', this.uncaught);
this._removeEventListener(process, 'unhandledRejection', this.unhandled);
this._addEventListener(process, 'uncaughtException', this.uncaught);
this._addEventListener(process, 'unhandledRejection', this.uncaught);
this._addEventListener(process, 'unhandledRejection', this.unhandled);

@@ -1073,0 +1097,0 @@ if (this._delay) {

{
"name": "mocha",
"version": "8.2.0",
"version": "8.2.1",
"description": "simple, flexible, fun test framework",

@@ -5,0 +5,0 @@ "keywords": [

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