Socket
Socket
Sign inDemoInstall

mocha

Package Overview
Dependencies
Maintainers
3
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.3.2 to 10.2.0

bin/mocha.js

47

browser-entry.js

@@ -43,3 +43,3 @@ 'use strict';

process.removeListener = function(e, fn) {
process.removeListener = function (e, fn) {
if (e === 'uncaughtException') {

@@ -49,3 +49,3 @@ if (originalOnerrorHandler) {

} else {
global.onerror = function() {};
global.onerror = function () {};
}

@@ -63,3 +63,3 @@ var i = uncaughtExceptionHandlers.indexOf(fn);

process.listenerCount = function(name) {
process.listenerCount = function (name) {
if (name === 'uncaughtException') {

@@ -75,5 +75,5 @@ return uncaughtExceptionHandlers.length;

process.on = function(e, fn) {
process.on = function (e, fn) {
if (e === 'uncaughtException') {
global.onerror = function(err, url, line) {
global.onerror = function (err, url, line) {
fn(new Error(err + ' (' + url + ':' + line + ')'));

@@ -86,3 +86,3 @@ return !mocha.options.allowUncaught;

process.listeners = function(e) {
process.listeners = function (e) {
if (e === 'uncaughtException') {

@@ -118,3 +118,3 @@ return uncaughtExceptionHandlers;

Mocha.Runner.immediately = function(callback) {
Mocha.Runner.immediately = function (callback) {
immediateQueue.push(callback);

@@ -131,4 +131,4 @@ if (!immediateTimeout) {

*/
mocha.throwError = function(err) {
uncaughtExceptionHandlers.forEach(function(fn) {
mocha.throwError = function (err) {
uncaughtExceptionHandlers.forEach(function (fn) {
fn(err);

@@ -144,3 +144,3 @@ });

mocha.ui = function(ui) {
mocha.ui = function (ui) {
Mocha.prototype.ui.call(this, ui);

@@ -155,3 +155,3 @@ this.suite.emit('pre-require', global, null, this);

mocha.setup = function(opts) {
mocha.setup = function (opts) {
if (typeof opts === 'string') {

@@ -165,6 +165,6 @@ opts = {ui: opts};

Object.keys(opts)
.filter(function(opt) {
.filter(function (opt) {
return opt !== 'delay';
})
.forEach(function(opt) {
.forEach(function (opt) {
if (Object.prototype.hasOwnProperty.call(opts, opt)) {

@@ -181,3 +181,3 @@ self[opt](opts[opt]);

mocha.run = function(fn) {
mocha.run = function (fn) {
var options = mocha.options;

@@ -197,3 +197,3 @@ mocha.globals('location');

return Mocha.prototype.run.call(mocha, function(err) {
return Mocha.prototype.run.call(mocha, function (err) {
// The DOM Document is not available in Web Workers.

@@ -224,9 +224,16 @@ var document = global.document;

*/
global.Mocha = Mocha;
global.mocha = mocha;
// this allows test/acceptance/required-tokens.js to pass; thus,
// you can now do `const describe = require('mocha').describe` in a
// browser context (assuming browserification). should fix #880
module.exports = Object.assign(mocha, global);
// for bundlers: enable `import {describe, it} from 'mocha'`
// `bdd` interface only
// prettier-ignore
[
'describe', 'context', 'it', 'specify',
'xdescribe', 'xcontext', 'xit', 'xspecify',
'before', 'beforeEach', 'afterEach', 'after'
].forEach(function(key) {
mocha[key] = global[key];
});
module.exports = mocha;

@@ -14,3 +14,3 @@ 'use strict';

.split('&')
.reduce(function(obj, pair) {
.reduce(function (obj, pair) {
var i = pair.indexOf('=');

@@ -17,0 +17,0 @@ var key = pair.slice(0, i);

@@ -30,3 +30,3 @@ 'use strict';

*/
Progress.prototype.size = function(size) {
Progress.prototype.size = function (size) {
this._size = size;

@@ -43,3 +43,3 @@ return this;

*/
Progress.prototype.text = function(text) {
Progress.prototype.text = function (text) {
this._text = text;

@@ -56,3 +56,3 @@ return this;

*/
Progress.prototype.fontSize = function(size) {
Progress.prototype.fontSize = function (size) {
this._fontSize = size;

@@ -68,3 +68,3 @@ return this;

*/
Progress.prototype.font = function(family) {
Progress.prototype.font = function (family) {
this._font = family;

@@ -80,3 +80,3 @@ return this;

*/
Progress.prototype.update = function(n) {
Progress.prototype.update = function (n) {
this.percent = n;

@@ -92,4 +92,18 @@ return this;

*/
Progress.prototype.draw = function(ctx) {
Progress.prototype.draw = function (ctx) {
try {
var darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
var isDarkMode = !!darkMatcher.matches;
var lightColors = {
outerCircle: '#9f9f9f',
innerCircle: '#eee',
text: '#000'
};
var darkColors = {
outerCircle: '#888',
innerCircle: '#444',
text: '#fff'
};
var colors = isDarkMode ? darkColors : lightColors;
var percent = Math.min(this.percent, 100);

@@ -109,3 +123,3 @@ var size = this._size;

// outer circle
ctx.strokeStyle = '#9f9f9f';
ctx.strokeStyle = colors.outerCircle;
ctx.beginPath();

@@ -116,3 +130,3 @@ ctx.arc(x, y, rad, 0, angle, false);

// inner circle
ctx.strokeStyle = '#eee';
ctx.strokeStyle = colors.innerCircle;
ctx.beginPath();

@@ -126,2 +140,3 @@ ctx.arc(x, y, rad - 1, 0, angle, true);

ctx.fillStyle = colors.text;
ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);

@@ -128,0 +143,0 @@ } catch (ignore) {

@@ -36,4 +36,5 @@ #!/usr/bin/env node

* @param {string[]} argv - Array of arguments to parse, or by default the lovely `process.argv.slice(2)`
* @param {object} [mochaArgs] - Object of already parsed Mocha arguments (by bin/mocha)
*/
exports.main = (argv = process.argv.slice(2)) => {
exports.main = (argv = process.argv.slice(2), mochaArgs) => {
debug('entered main with raw args', argv);

@@ -47,3 +48,3 @@ // ensure we can require() from current working directory

var args = loadOptions(argv);
var args = mochaArgs || loadOptions(argv);

@@ -50,0 +51,0 @@ yargs()

@@ -5,3 +5,3 @@ 'use strict';

* Exports Yargs commands
* @see https://git.io/fpJ0G
* @see https://github.com/yargs/yargs/blob/main/docs/advanced.md
* @private

@@ -8,0 +8,0 @@ * @module

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

const findUp = require('find-up');
const {createUnparsableFileError} = require('../errors');
const utils = require('../utils');

@@ -33,6 +34,2 @@

const isModuleNotFoundError = err =>
err.code !== 'MODULE_NOT_FOUND' ||
err.message.indexOf('Cannot find module') !== -1;
/**

@@ -45,13 +42,12 @@ * Parsers for various config filetypes. Each accepts a filepath and

js: filepath => {
const cwdFilepath = path.resolve(filepath);
let cwdFilepath;
try {
debug('parsers: load using cwd-relative path: "%s"', cwdFilepath);
debug('parsers: load cwd-relative path: "%s"', path.resolve(filepath));
cwdFilepath = require.resolve(path.resolve(filepath)); // evtl. throws
return require(cwdFilepath);
} catch (err) {
if (isModuleNotFoundError(err)) {
debug('parsers: retry load as module-relative path: "%s"', filepath);
return require(filepath);
} else {
throw err; // rethrow
}
if (cwdFilepath) throw err;
debug('parsers: retry load as module-relative path: "%s"', filepath);
return require(filepath);
}

@@ -87,3 +83,6 @@ },

} catch (err) {
throw new Error(`failed to parse config "${filepath}": ${err}`);
throw createUnparsableFileError(
`Unable to read/parse ${filepath}: ${err}`,
filepath
);
}

@@ -90,0 +89,0 @@ return config;

@@ -11,7 +11,5 @@ 'use strict';

var glob = require('glob');
var {format} = require('util');
var errors = require('../errors');
var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
var createMissingArgumentError = errors.createMissingArgumentError;
var {sQuote, dQuote} = require('../utils');
const debug = require('debug')('mocha:cli:lookup-files');

@@ -95,3 +93,3 @@

throw createNoFilesMatchPatternError(
'Cannot find any files matching pattern ' + dQuote(filepath),
`Cannot find any files matching pattern "${filepath}"`,
filepath

@@ -132,7 +130,3 @@ );

throw createMissingArgumentError(
format(
'Argument %s required when argument %s is a directory',
sQuote('extensions'),
sQuote('filepath')
),
`Argument '${extensions}' required when argument '${filepath}' is a directory`,
'extensions',

@@ -139,0 +133,0 @@ 'array'

@@ -52,3 +52,3 @@ 'use strict';

debugFlags.has(flag) ||
/(?:preserve-symlinks(?:-main)?|harmony(?:[_-]|$)|(?:trace[_-].+$)|gc(?:[_-]global)?$|es[_-]staging$|use[_-]strict$|v8[_-](?!options).+?$)/.test(
/(?:preserve-symlinks(?:-main)?|harmony(?:[_-]|$)|(?:trace[_-].+$)|gc[_-]global$|es[_-]staging$|use[_-]strict$|v8[_-](?!options).+?$)/.test(
flag

@@ -71,3 +71,2 @@ )

* Unparse these arguments using `yargs-unparser` (which would result in `--inspect 0.0.0.0`), then supply `=` where we have values.
* Apparently --require in Node.js v8 does NOT want `=`.
* There's probably an easier or more robust way to do this; fixes welcome

@@ -84,5 +83,3 @@ * @param {Object} opts - Arguments object

.split(/\b/)
.map((arg, index, args) =>
arg === ' ' && args[index - 1] !== 'require' ? '=' : arg
)
.map(arg => (arg === ' ' ? '=' : arg))
.join('')

@@ -89,0 +86,0 @@ .split(' ')

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

const align = require('wide-align');
const Mocha = require('../mocha');

@@ -34,3 +33,3 @@

console.log(
` ${align.left(key, maxKeyLength + 1)}${
` ${key.padEnd(maxKeyLength + 1)}${
description ? `- ${description}` : ''

@@ -37,0 +36,0 @@ }`

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

const {isNodeFlag} = require('./node-flags');
const {createUnparsableFileError} = require('../errors');

@@ -194,3 +195,6 @@ /**

if (args.package) {
throw new Error(`Unable to read/parse ${filepath}: ${err}`);
throw createUnparsableFileError(
`Unable to read/parse ${filepath}: ${err}`,
filepath
);
}

@@ -197,0 +201,0 @@ debug('failed to read default package.json at %s; ignoring', filepath);

@@ -17,3 +17,3 @@ 'use strict';

const {createInvalidLegacyPluginError} = require('../errors');
const {requireOrImport} = require('../esm-utils');
const {requireOrImport} = require('../nodejs/esm-utils');
const PluginLoader = require('../plugin-loader');

@@ -199,6 +199,6 @@

* @param {Object} opts - Options object
* @param {"reporter"|"interface"} pluginType - Type of plugin.
* @param {Object} [map] - An object perhaps having key `key`. Used as a cache
* of sorts; `Mocha.reporters` is one, where each key corresponds to a reporter
* name
* @param {"reporter"|"ui"} pluginType - Type of plugin.
* @param {Object} [map] - Used as a cache of sorts;
* `Mocha.reporters` where each key corresponds to a reporter name,
* `Mocha.interfaces` where each key corresponds to an interface name.
* @private

@@ -230,14 +230,14 @@ */

if (!map[pluginId]) {
let foundId;
try {
opts[pluginType] = require(pluginId);
foundId = require.resolve(pluginId);
map[pluginId] = require(foundId);
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
// Try to load reporters from a path (absolute or relative)
try {
opts[pluginType] = require(path.resolve(pluginId));
} catch (err) {
throw createUnknownError(err);
}
} else {
throw createUnknownError(err);
if (foundId) throw createUnknownError(err);
// Try to load reporters from a cwd-relative path
try {
map[pluginId] = require(path.resolve(pluginId));
} catch (e) {
throw createUnknownError(e);
}

@@ -244,0 +244,0 @@ }

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

'ignore',
'node-option',
'reporter-option',

@@ -36,7 +37,8 @@ 'require',

'diff',
'dry-run',
'exit',
'fail-zero',
'forbid-only',
'forbid-pending',
'full-trace',
'growl',
'inline-diffs',

@@ -78,3 +80,2 @@ 'invert',

grep: ['g'],
growl: ['G'],
ignore: ['exclude'],

@@ -84,2 +85,3 @@ invert: ['i'],

'no-colors': ['C'],
'node-option': ['n'],
parallel: ['p'],

@@ -86,0 +88,0 @@ reporter: ['R'],

@@ -86,2 +86,6 @@ 'use strict';

},
'dry-run': {
description: 'Report tests without executing them',
group: GROUPS.RULES
},
exit: {

@@ -98,2 +102,6 @@ description: 'Force Mocha to quit after tests complete',

},
'fail-zero': {
description: 'Fail test run if no test(s) encountered',
group: GROUPS.RULES
},
fgrep: {

@@ -138,6 +146,2 @@ conflicts: 'grep',

},
growl: {
description: 'Enable Growl notifications',
group: GROUPS.OUTPUT
},
ignore: {

@@ -178,2 +182,6 @@ defaultDescription: '(none)',

},
'node-option': {
description: 'Node or V8 option (no leading "--")',
group: GROUPS.CONFIG
},
package: {

@@ -328,3 +336,3 @@ description: 'Path to package.json for config',

`--compilers is DEPRECATED and no longer supported.
See https://git.io/vdcSr for migration information.`
See https://github.com/mochajs/mocha/wiki/compilers-deprecation for migration information.`
);

@@ -362,3 +370,3 @@ }

exports.handler = async function(argv) {
exports.handler = async function (argv) {
debug('post-yargs config', argv);

@@ -365,0 +373,0 @@ const mocha = new Mocha(argv);

@@ -49,3 +49,3 @@ 'use strict';

// exports set via the below call to `mocha.ui()` won't work properly if a
// test depends on this module (see `required-tokens.spec.js`).
// test depends on this module.
const Mocha = require('../mocha');

@@ -112,3 +112,3 @@

// exports set via the below call to `mocha.ui()` won't work properly if a
// test depends on this module (see `required-tokens.spec.js`).
// test depends on this module.
const Mocha = require('../mocha');

@@ -236,6 +236,3 @@

process.stdin.on('data', data => {
const str = data
.toString()
.trim()
.toLowerCase();
const str = data.toString().trim().toLowerCase();
if (str === 'rs') rerunner.scheduleRun();

@@ -267,13 +264,17 @@ });

const run = () => {
mocha = beforeRun ? beforeRun({mocha, watcher}) || mocha : mocha;
runner = mocha.run(() => {
debug('finished watch run');
runner = null;
blastCache(watcher);
if (rerunScheduled) {
rerun();
} else {
console.error(`${logSymbols.info} [mocha] waiting for changes...`);
}
});
try {
mocha = beforeRun ? beforeRun({mocha, watcher}) || mocha : mocha;
runner = mocha.run(() => {
debug('finished watch run');
runner = null;
blastCache(watcher);
if (rerunScheduled) {
rerun();
} else {
console.error(`${logSymbols.info} [mocha] waiting for changes...`);
}
});
} catch (e) {
console.error(e.stack);
}
};

@@ -280,0 +281,0 @@

@@ -25,3 +25,3 @@ 'use strict';

*/
Context.prototype.runnable = function(runnable) {
Context.prototype.runnable = function (runnable) {
if (!arguments.length) {

@@ -41,3 +41,3 @@ return this._runnable;

*/
Context.prototype.timeout = function(ms) {
Context.prototype.timeout = function (ms) {
if (!arguments.length) {

@@ -57,3 +57,3 @@ return this.runnable().timeout();

*/
Context.prototype.slow = function(ms) {
Context.prototype.slow = function (ms) {
if (!arguments.length) {

@@ -72,3 +72,3 @@ return this.runnable().slow();

*/
Context.prototype.skip = function() {
Context.prototype.skip = function () {
this.runnable().skip();

@@ -84,3 +84,3 @@ };

*/
Context.prototype.retries = function(n) {
Context.prototype.retries = function (n) {
if (!arguments.length) {

@@ -87,0 +87,0 @@ return this.runnable().retries();

@@ -21,3 +21,3 @@ 'use strict';

/* istanbul ignore next */
process.nextTick(function() {
process.nextTick(function () {
console.warn(type + ': ' + msg);

@@ -167,3 +167,10 @@ });

*/
TIMEOUT: 'ERR_MOCHA_TIMEOUT'
TIMEOUT: 'ERR_MOCHA_TIMEOUT',
/**
* Input file is not able to be parsed
* @constant
* @default
*/
UNPARSABLE_FILE: 'ERR_MOCHA_UNPARSABLE_FILE'
};

@@ -326,3 +333,3 @@

* @param {string} message - Error message
* @param {"reporter"|"interface"} pluginType - Plugin type. Future: expand as needed
* @param {"reporter"|"ui"} pluginType - Plugin type. Future: expand as needed
* @param {string} [pluginId] - Name/path of plugin, if any

@@ -338,3 +345,3 @@ * @throws When `pluginType` is not known

return createInvalidReporterError(message, pluginId);
case 'interface':
case 'ui':
return createInvalidInterfaceError(message, pluginId);

@@ -503,2 +510,16 @@ default:

/**
* Creates an error object to be thrown when file is unparsable
* @public
* @static
* @param {string} message - Error message to be displayed.
* @param {string} filename - File name
* @returns {Error} Error with code {@link constants.UNPARSABLE_FILE}
*/
function createUnparsableFileError(message, filename) {
var err = new Error(message);
err.code = constants.UNPARSABLE_FILE;
return err;
}
/**
* Returns `true` if an error came out of Mocha.

@@ -533,2 +554,3 @@ * _Can suffer from false negatives, but not false positives._

createTimeoutError,
createUnparsableFileError,
createUnsupportedError,

@@ -535,0 +557,0 @@ deprecate,

@@ -34,3 +34,3 @@ 'use strict';

*/
Hook.prototype.reset = function() {
Hook.prototype.reset = function () {
Runnable.prototype.reset.call(this);

@@ -48,3 +48,3 @@ delete this._error;

*/
Hook.prototype.error = function(err) {
Hook.prototype.error = function (err) {
if (!arguments.length) {

@@ -67,3 +67,5 @@ err = this._error;

return {
$$isPending: this.isPending(),
$$currentRetry: this.currentRetry(),
$$fullTitle: this.fullTitle(),
$$isPending: Boolean(this.isPending()),
$$titlePath: this.titlePath(),

@@ -79,5 +81,9 @@ ctx:

: {},
duration: this.duration,
file: this.file,
parent: {
$$fullTitle: this.parent.fullTitle(),
[MOCHA_ID_PROP_NAME]: this.parent.id
},
state: this.state,
title: this.title,

@@ -84,0 +90,0 @@ type: this.type,

'use strict';
var Test = require('../test');
var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
.EVENT_FILE_PRE_REQUIRE;
var EVENT_FILE_PRE_REQUIRE =
require('../suite').constants.EVENT_FILE_PRE_REQUIRE;

@@ -27,3 +27,3 @@ /**

suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
var common = require('./common')(suites, context, mocha);

@@ -42,7 +42,7 @@

context.describe = context.context = function(title, fn) {
context.describe = context.context = function (title, fn) {
return common.suite.create({
title: title,
file: file,
fn: fn
title,
file,
fn
});

@@ -55,12 +55,12 @@ };

context.xdescribe = context.xcontext = context.describe.skip = function(
title,
fn
) {
return common.suite.skip({
title: title,
file: file,
fn: fn
});
};
context.xdescribe =
context.xcontext =
context.describe.skip =
function (title, fn) {
return common.suite.skip({
title,
file,
fn
});
};

@@ -71,7 +71,7 @@ /**

context.describe.only = function(title, fn) {
context.describe.only = function (title, fn) {
return common.suite.only({
title: title,
file: file,
fn: fn
title,
file,
fn
});

@@ -86,3 +86,3 @@ };

context.it = context.specify = function(title, fn) {
context.it = context.specify = function (title, fn) {
var suite = suites[0];

@@ -102,3 +102,3 @@ if (suite.isPending()) {

context.it.only = function(title, fn) {
context.it.only = function (title, fn) {
return common.test.only(mocha, context.it(title, fn));

@@ -111,12 +111,8 @@ };

context.xit = context.xspecify = context.it.skip = function(title) {
return context.it(title);
};
/**
* Number of attempts to retry.
*/
context.it.retries = function(n) {
context.retries(n);
};
context.xit =
context.xspecify =
context.it.skip =
function (title) {
return context.it(title);
};
});

@@ -123,0 +119,0 @@ };

@@ -22,3 +22,3 @@ 'use strict';

*/
module.exports = function(suites, context, mocha) {
module.exports = function (suites, context, mocha) {
/**

@@ -60,3 +60,3 @@ * Check if the suite should be tested.

*/
before: function(name, fn) {
before: function (name, fn) {
suites[0].beforeAll(name, fn);

@@ -71,3 +71,3 @@ },

*/
after: function(name, fn) {
after: function (name, fn) {
suites[0].afterAll(name, fn);

@@ -82,3 +82,3 @@ },

*/
beforeEach: function(name, fn) {
beforeEach: function (name, fn) {
suites[0].beforeEach(name, fn);

@@ -93,3 +93,3 @@ },

*/
afterEach: function(name, fn) {
afterEach: function (name, fn) {
suites[0].afterEach(name, fn);

@@ -180,3 +180,3 @@ },

*/
only: function(mocha, test) {
only: function (mocha, test) {
if (mocha.options.forbidOnly) {

@@ -194,13 +194,4 @@ throw createForbiddenExclusivityError(mocha);

*/
skip: function(title) {
skip: function (title) {
context.test(title);
},
/**
* Number of retry attempts
*
* @param {number} n
*/
retries: function(n) {
context.retries(n);
}

@@ -207,0 +198,0 @@ }

@@ -22,3 +22,3 @@ 'use strict';

*/
module.exports = function(suite) {
module.exports = function (suite) {
var suites = [suite];

@@ -25,0 +25,0 @@

'use strict';
var Test = require('../test');
var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
.EVENT_FILE_PRE_REQUIRE;
var EVENT_FILE_PRE_REQUIRE =
require('../suite').constants.EVENT_FILE_PRE_REQUIRE;

@@ -35,3 +35,3 @@ /**

suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
var common = require('./common')(suites, context, mocha);

@@ -48,3 +48,3 @@

context.suite = function(title) {
context.suite = function (title) {
if (suites.length > 1) {

@@ -54,4 +54,4 @@ suites.shift();

return common.suite.create({
title: title,
file: file,
title,
file,
fn: false

@@ -65,3 +65,3 @@ });

context.suite.only = function(title) {
context.suite.only = function (title) {
if (suites.length > 1) {

@@ -71,4 +71,4 @@ suites.shift();

return common.suite.only({
title: title,
file: file,
title,
file,
fn: false

@@ -84,3 +84,3 @@ });

context.test = function(title, fn) {
context.test = function (title, fn) {
var test = new Test(title, fn);

@@ -96,3 +96,3 @@ test.file = file;

context.test.only = function(title, fn) {
context.test.only = function (title, fn) {
return common.test.only(mocha, context.test(title, fn));

@@ -102,3 +102,2 @@ };

context.test.skip = common.test.skip;
context.test.retries = common.test.retries;
});

@@ -105,0 +104,0 @@ };

'use strict';
var Test = require('../test');
var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
.EVENT_FILE_PRE_REQUIRE;
var EVENT_FILE_PRE_REQUIRE =
require('../suite').constants.EVENT_FILE_PRE_REQUIRE;

@@ -32,6 +32,6 @@ /**

*/
module.exports = function(suite) {
module.exports = function (suite) {
var suites = [suite];
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
var common = require('./common')(suites, context, mocha);

@@ -49,7 +49,7 @@

*/
context.suite = function(title, fn) {
context.suite = function (title, fn) {
return common.suite.create({
title: title,
file: file,
fn: fn
title,
file,
fn
});

@@ -61,7 +61,7 @@ };

*/
context.suite.skip = function(title, fn) {
context.suite.skip = function (title, fn) {
return common.suite.skip({
title: title,
file: file,
fn: fn
title,
file,
fn
});

@@ -73,7 +73,7 @@ };

*/
context.suite.only = function(title, fn) {
context.suite.only = function (title, fn) {
return common.suite.only({
title: title,
file: file,
fn: fn
title,
file,
fn
});

@@ -86,3 +86,3 @@ };

*/
context.test = function(title, fn) {
context.test = function (title, fn) {
var suite = suites[0];

@@ -102,3 +102,3 @@ if (suite.isPending()) {

context.test.only = function(title, fn) {
context.test.only = function (title, fn) {
return common.test.only(mocha, context.test(title, fn));

@@ -108,3 +108,2 @@ };

context.test.skip = common.test.skip;
context.test.retries = common.test.retries;
});

@@ -111,0 +110,0 @@ };

@@ -12,12 +12,8 @@ 'use strict';

var builtinReporters = require('./reporters');
var growl = require('./nodejs/growl');
var utils = require('./utils');
var mocharc = require('./mocharc.json');
var Suite = require('./suite');
var esmUtils = utils.supportsEsModules(true)
? require('./esm-utils')
: undefined;
var esmUtils = require('./nodejs/esm-utils');
var createStatsCollector = require('./stats-collector');
const {
warn,
createInvalidReporterError,

@@ -29,8 +25,4 @@ createInvalidInterfaceError,

} = require('./errors');
const {
EVENT_FILE_PRE_REQUIRE,
EVENT_FILE_POST_REQUIRE,
EVENT_FILE_REQUIRE
} = Suite.constants;
var sQuote = utils.sQuote;
const {EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE} =
Suite.constants;
var debug = require('debug')('mocha:mocha');

@@ -102,3 +94,3 @@

let currentContext;
exports.afterEach = function(...args) {
exports.afterEach = function (...args) {
return (currentContext.afterEach || currentContext.teardown).apply(

@@ -109,3 +101,3 @@ this,

};
exports.after = function(...args) {
exports.after = function (...args) {
return (currentContext.after || currentContext.suiteTeardown).apply(

@@ -116,12 +108,12 @@ this,

};
exports.beforeEach = function(...args) {
exports.beforeEach = function (...args) {
return (currentContext.beforeEach || currentContext.setup).apply(this, args);
};
exports.before = function(...args) {
exports.before = function (...args) {
return (currentContext.before || currentContext.suiteSetup).apply(this, args);
};
exports.describe = function(...args) {
exports.describe = function (...args) {
return (currentContext.describe || currentContext.suite).apply(this, args);
};
exports.describe.only = function(...args) {
exports.describe.only = function (...args) {
return (currentContext.describe || currentContext.suite).only.apply(

@@ -132,3 +124,3 @@ this,

};
exports.describe.skip = function(...args) {
exports.describe.skip = function (...args) {
return (currentContext.describe || currentContext.suite).skip.apply(

@@ -139,9 +131,9 @@ this,

};
exports.it = function(...args) {
exports.it = function (...args) {
return (currentContext.it || currentContext.test).apply(this, args);
};
exports.it.only = function(...args) {
exports.it.only = function (...args) {
return (currentContext.it || currentContext.test).only.apply(this, args);
};
exports.it.skip = function(...args) {
exports.it.skip = function (...args) {
return (currentContext.it || currentContext.test).skip.apply(this, args);

@@ -157,3 +149,3 @@ };

exports.test = exports.it;
exports.run = function(...args) {
exports.run = function (...args) {
return currentContext.run.apply(this, args);

@@ -175,2 +167,4 @@ };

* @param {boolean} [options.diff] - Show diff on failure?
* @param {boolean} [options.dryRun] - Report tests without running them?
* @param {boolean} [options.failZero] - Fail test run if zero tests?
* @param {string} [options.fgrep] - Test filter given string.

@@ -182,3 +176,2 @@ * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?

* @param {RegExp|string} [options.grep] - Test filter given regular expression.
* @param {boolean} [options.growl] - Enable desktop notifications?
* @param {boolean} [options.inlineDiffs] - Display inline diffs?

@@ -193,6 +186,6 @@ * @param {boolean} [options.invert] - Invert test filter matches?

* @param {string} [options.ui] - Interface name.
* @param {boolean} [options.parallel] - Run jobs in parallel
* @param {number} [options.jobs] - Max number of worker processes for parallel runs
* @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root
* suite with
* @param {boolean} [options.parallel] - Run jobs in parallel.
* @param {number} [options.jobs] - Max number of worker processes for parallel runs.
* @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root suite with.
* @param {string[]} [options.require] - Pathname of `rootHooks` plugin for parallel runs.
* @param {boolean} [options.isWorker] - Should be `true` if `Mocha` process is running in a worker process.

@@ -214,3 +207,3 @@ */

options.reporter,
options.reporterOption || options.reporterOptions // reporterOptions was previously the only way to specify options to reporter
options.reporterOption || options.reporterOptions // for backwards compatibility
)

@@ -237,9 +230,10 @@ .slow(options.slow)

'diff',
'dryRun',
'failZero',
'forbidOnly',
'forbidPending',
'fullTrace',
'growl',
'inlineDiffs',
'invert'
].forEach(function(opt) {
].forEach(function (opt) {
if (options[opt]) {

@@ -302,3 +296,3 @@ this[opt]();

*/
Mocha.prototype.bail = function(bail) {
Mocha.prototype.bail = function (bail) {
this.suite.bail(bail !== false);

@@ -321,3 +315,3 @@ return this;

*/
Mocha.prototype.addFile = function(file) {
Mocha.prototype.addFile = function (file) {
this.files.push(file);

@@ -343,3 +337,3 @@ return this;

*/
Mocha.prototype.reporter = function(reporterName, reporterOptions) {
Mocha.prototype.reporter = function (reporterName, reporterOptions) {
if (typeof reporterName === 'function') {

@@ -356,35 +350,22 @@ this._reporter = reporterName;

if (!reporter) {
let foundReporter;
try {
reporter = require(reporterName);
foundReporter = require.resolve(reporterName);
reporter = require(foundReporter);
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
// Try to load reporters from a path (absolute or relative)
try {
reporter = require(path.resolve(utils.cwd(), reporterName));
} catch (_err) {
_err.code === 'MODULE_NOT_FOUND'
? warn(sQuote(reporterName) + ' reporter not found')
: warn(
sQuote(reporterName) +
' reporter blew up with error:\n' +
err.stack
);
}
} else {
warn(
sQuote(reporterName) + ' reporter blew up with error:\n' + err.stack
);
if (foundReporter) {
throw createInvalidReporterError(err.message, foundReporter);
}
// Try to load reporters from a cwd-relative path
try {
reporter = require(path.resolve(reporterName));
} catch (e) {
throw createInvalidReporterError(e.message, reporterName);
}
}
}
if (!reporter) {
throw createInvalidReporterError(
'invalid reporter ' + sQuote(reporterName),
reporterName
);
}
this._reporter = reporter;
}
this.options.reporterOption = reporterOptions;
// alias option name is used in public reporters xunit/tap/progress
// alias option name is used in built-in reporters xunit/tap/progress
this.options.reporterOptions = reporterOptions;

@@ -405,3 +386,3 @@ return this;

*/
Mocha.prototype.ui = function(ui) {
Mocha.prototype.ui = function (ui) {
var bindInterface;

@@ -417,6 +398,3 @@ if (typeof ui === 'function') {

} catch (err) {
throw createInvalidInterfaceError(
'invalid interface ' + sQuote(ui),
ui
);
throw createInvalidInterfaceError(`invalid interface '${ui}'`, ui);
}

@@ -427,3 +405,3 @@ }

this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
this.suite.on(EVENT_FILE_PRE_REQUIRE, function (context) {
currentContext = context;

@@ -450,6 +428,6 @@ });

*/
Mocha.prototype.loadFiles = function(fn) {
Mocha.prototype.loadFiles = function (fn) {
var self = this;
var suite = this.suite;
this.files.forEach(function(file) {
this.files.forEach(function (file) {
file = path.resolve(file);

@@ -475,2 +453,4 @@ suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);

* @see {@link Mocha#unloadFiles}
* @param {Object} [options] - Settings object.
* @param {Function} [options.esmDecorator] - Function invoked on esm module name right before importing it. By default will passthrough as is.
* @returns {Promise}

@@ -484,3 +464,3 @@ * @example

*/
Mocha.prototype.loadFilesAsync = function() {
Mocha.prototype.loadFilesAsync = function ({esmDecorator} = {}) {
var self = this;

@@ -490,17 +470,12 @@ var suite = this.suite;

if (!esmUtils) {
return new Promise(function(resolve) {
self.loadFiles(resolve);
});
}
return esmUtils.loadFilesAsync(
this.files,
function(file) {
function (file) {
suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
},
function(file, resultModule) {
function (file, resultModule) {
suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
}
},
esmDecorator
);

@@ -517,6 +492,6 @@ };

*/
Mocha.unloadFile = function(file) {
Mocha.unloadFile = function (file) {
if (utils.isBrowser()) {
throw createUnsupportedError(
'unloadFile() is only suported in a Node.js environment'
'unloadFile() is only supported in a Node.js environment'
);

@@ -542,3 +517,3 @@ }

*/
Mocha.prototype.unloadFiles = function() {
Mocha.prototype.unloadFiles = function () {
if (this._state === mochaStates.DISPOSED) {

@@ -552,3 +527,3 @@ throw createMochaInstanceAlreadyDisposedError(

this.files.forEach(function(file) {
this.files.forEach(function (file) {
Mocha.unloadFile(file);

@@ -573,3 +548,3 @@ });

*/
Mocha.prototype.fgrep = function(str) {
Mocha.prototype.fgrep = function (str) {
if (!str) {

@@ -615,6 +590,6 @@ return this;

*/
Mocha.prototype.grep = function(re) {
Mocha.prototype.grep = function (re) {
if (utils.isString(re)) {
// extract args if it's regex-like, i.e: [string, pattern, flag]
var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
var arg = re.match(/^\/(.*)\/([gimy]{0,4})$|.*/);
this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);

@@ -639,3 +614,3 @@ } else {

*/
Mocha.prototype.invert = function() {
Mocha.prototype.invert = function () {
this.options.invert = true;

@@ -654,3 +629,3 @@ return this;

*/
Mocha.prototype.checkLeaks = function(checkLeaks) {
Mocha.prototype.checkLeaks = function (checkLeaks) {
this.options.checkLeaks = checkLeaks !== false;

@@ -670,3 +645,3 @@ return this;

*/
Mocha.prototype.cleanReferencesAfterRun = function(cleanReferencesAfterRun) {
Mocha.prototype.cleanReferencesAfterRun = function (cleanReferencesAfterRun) {
this._cleanReferencesAfterRun = cleanReferencesAfterRun !== false;

@@ -681,3 +656,3 @@ return this;

*/
Mocha.prototype.dispose = function() {
Mocha.prototype.dispose = function () {
if (this._state === mochaStates.RUNNING) {

@@ -703,3 +678,3 @@ throw createMochaInstanceAlreadyRunningError(

*/
Mocha.prototype.fullTrace = function(fullTrace) {
Mocha.prototype.fullTrace = function (fullTrace) {
this.options.fullTrace = fullTrace !== false;

@@ -710,45 +685,2 @@ return this;

/**
* Enables desktop notification support if prerequisite software installed.
*
* @public
* @see [CLI option](../#-growl-g)
* @return {Mocha} this
* @chainable
*/
Mocha.prototype.growl = function() {
this.options.growl = this.isGrowlCapable();
if (!this.options.growl) {
var detail = utils.isBrowser()
? 'notification support not available in this browser...'
: 'notification support prerequisites not installed...';
console.error(detail + ' cannot enable!');
}
return this;
};
/**
* @summary
* Determines if Growl support seems likely.
*
* @description
* <strong>Not available when run in browser.</strong>
*
* @private
* @see {@link Growl#isCapable}
* @see {@link Mocha#growl}
* @return {boolean} whether Growl support can be expected
*/
Mocha.prototype.isGrowlCapable = growl.isCapable;
/**
* Implements desktop notifications using a pseudo-reporter.
*
* @private
* @see {@link Mocha#growl}
* @see {@link Growl#notify}
* @param {Runner} runner - Runner instance.
*/
Mocha.prototype._growl = growl.notify;
/**
* Specifies whitelist of variable names to be expected in global scope.

@@ -767,7 +699,7 @@ *

*/
Mocha.prototype.global = function(global) {
Mocha.prototype.global = function (global) {
this.options.global = (this.options.global || [])
.concat(global)
.filter(Boolean)
.filter(function(elt, idx, arr) {
.filter(function (elt, idx, arr) {
return arr.indexOf(elt) === idx;

@@ -777,3 +709,3 @@ });

};
// for backwards compability, 'globals' is an alias of 'global'
// for backwards compatibility, 'globals' is an alias of 'global'
Mocha.prototype.globals = Mocha.prototype.global;

@@ -790,3 +722,3 @@

*/
Mocha.prototype.color = function(color) {
Mocha.prototype.color = function (color) {
this.options.color = color !== false;

@@ -806,3 +738,3 @@ return this;

*/
Mocha.prototype.inlineDiffs = function(inlineDiffs) {
Mocha.prototype.inlineDiffs = function (inlineDiffs) {
this.options.inlineDiffs = inlineDiffs !== false;

@@ -821,3 +753,3 @@ return this;

*/
Mocha.prototype.diff = function(diff) {
Mocha.prototype.diff = function (diff) {
this.options.diff = diff !== false;

@@ -850,3 +782,3 @@ return this;

*/
Mocha.prototype.timeout = function(msecs) {
Mocha.prototype.timeout = function (msecs) {
this.suite.timeout(msecs);

@@ -870,3 +802,3 @@ return this;

*/
Mocha.prototype.retries = function(retry) {
Mocha.prototype.retries = function (retry) {
this.suite.retries(retry);

@@ -893,3 +825,3 @@ return this;

*/
Mocha.prototype.slow = function(msecs) {
Mocha.prototype.slow = function (msecs) {
this.suite.slow(msecs);

@@ -908,3 +840,3 @@ return this;

*/
Mocha.prototype.asyncOnly = function(asyncOnly) {
Mocha.prototype.asyncOnly = function (asyncOnly) {
this.options.asyncOnly = asyncOnly !== false;

@@ -921,3 +853,3 @@ return this;

*/
Mocha.prototype.noHighlighting = function() {
Mocha.prototype.noHighlighting = function () {
this.options.noHighlighting = true;

@@ -936,3 +868,3 @@ return this;

*/
Mocha.prototype.allowUncaught = function(allowUncaught) {
Mocha.prototype.allowUncaught = function (allowUncaught) {
this.options.allowUncaught = allowUncaught !== false;

@@ -960,2 +892,30 @@ return this;

/**
* Enables or disables running tests in dry-run mode.
*
* @public
* @see [CLI option](../#-dry-run)
* @param {boolean} [dryRun=true] - Whether to activate dry-run mode.
* @return {Mocha} this
* @chainable
*/
Mocha.prototype.dryRun = function (dryRun) {
this.options.dryRun = dryRun !== false;
return this;
};
/**
* Fails test run if no tests encountered with exit-code 1.
*
* @public
* @see [CLI option](../#-fail-zero)
* @param {boolean} [failZero=true] - Whether to fail test run.
* @return {Mocha} this
* @chainable
*/
Mocha.prototype.failZero = function (failZero) {
this.options.failZero = failZero !== false;
return this;
};
/**
* Causes tests marked `only` to fail the suite.

@@ -969,3 +929,3 @@ *

*/
Mocha.prototype.forbidOnly = function(forbidOnly) {
Mocha.prototype.forbidOnly = function (forbidOnly) {
this.options.forbidOnly = forbidOnly !== false;

@@ -984,3 +944,3 @@ return this;

*/
Mocha.prototype.forbidPending = function(forbidPending) {
Mocha.prototype.forbidPending = function (forbidPending) {
this.options.forbidPending = forbidPending !== false;

@@ -994,3 +954,3 @@ return this;

*/
Mocha.prototype._guardRunningStateTransition = function() {
Mocha.prototype._guardRunningStateTransition = function () {
if (this._state === mochaStates.RUNNING) {

@@ -1054,3 +1014,3 @@ throw createMochaInstanceAlreadyRunningError(

*/
Mocha.prototype.run = function(fn) {
Mocha.prototype.run = function (fn) {
this._guardRunningStateTransition();

@@ -1069,4 +1029,6 @@ this._state = mochaStates.RUNNING;

const runner = new this._runnerClass(suite, {
cleanReferencesAfterRun: this._cleanReferencesAfterRun,
delay: options.delay,
cleanReferencesAfterRun: this._cleanReferencesAfterRun
dryRun: options.dryRun,
failZero: options.failZero
});

@@ -1087,5 +1049,2 @@ createStatsCollector(runner);

}
if (options.growl) {
this._growl(runner);
}
if (options.color !== undefined) {

@@ -1358,5 +1317,6 @@ exports.reporters.Base.useColors = options.color;

*/
Mocha.prototype.hasGlobalTeardownFixtures = function hasGlobalTeardownFixtures() {
return Boolean(this.options.globalTeardown.length);
};
Mocha.prototype.hasGlobalTeardownFixtures =
function hasGlobalTeardownFixtures() {
return Boolean(this.options.globalTeardown.length);
};

@@ -1363,0 +1323,0 @@ /**

@@ -78,3 +78,19 @@ /**

this.options = {...WORKER_POOL_DEFAULT_OPTS, opts, maxWorkers};
let counter = 0;
const onCreateWorker = ({forkOpts}) => {
return {
forkOpts: {
...forkOpts,
// adds an incremental id to all workers, which can be useful to allocate resources for each process
env: {...process.env, MOCHA_WORKER_ID: counter++}
}
};
};
this.options = {
...WORKER_POOL_DEFAULT_OPTS,
...opts,
maxWorkers,
onCreateWorker
};
this._pool = workerpool.pool(WORKER_PATH, this.options);

@@ -81,0 +97,0 @@ }

@@ -9,3 +9,2 @@ /**

const allSettled = require('@ungap/promise-all-settled').bind(Promise);
const Runner = require('../runner');

@@ -275,4 +274,5 @@ const {EVENT_RUN_BEGIN, EVENT_RUN_END} = Runner.constants;

* number of test failures.
* @param {{files: string[], options: Options}} opts - Files to run and
* command-line options, respectively.
* @param {Object} [opts] - options
* @param {string[]} opts.files - Files to run
* @param {Options} opts.options - command-line options
*/

@@ -326,3 +326,3 @@ run(callback, {files, options = {}} = {}) {

const results = await allSettled(
const results = await Promise.allSettled(
files.map(this._createFileRunner(pool, options))

@@ -329,0 +329,0 @@ );

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

var supportsColor = require('supports-color');
var symbols = require('log-symbols');
var constants = require('../runner').constants;

@@ -60,2 +61,7 @@ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;

/**
* Truncate diffs longer than this value to avoid slow performance
*/
exports.maxDiffSize = 8192;
/**
* Default color map.

@@ -93,5 +99,5 @@ */

exports.symbols = {
ok: '✓',
err: '✖',
dot: '․',
ok: symbols.success,
err: symbols.error,
dot: '.',
comma: ',',

@@ -101,9 +107,2 @@ bang: '!'

// With node.js on Windows: use symbols available in terminal default fonts
if (process.platform === 'win32') {
exports.symbols.ok = '\u221A';
exports.symbols.err = '\u00D7';
exports.symbols.dot = '.';
}
/**

@@ -120,3 +119,3 @@ * Color `str` with the given `type`,

*/
var color = (exports.color = function(type, str) {
var color = (exports.color = function (type, str) {
if (!exports.useColors) {

@@ -149,19 +148,19 @@ return String(str);

exports.cursor = {
hide: function() {
hide: function () {
isatty && process.stdout.write('\u001b[?25l');
},
show: function() {
show: function () {
isatty && process.stdout.write('\u001b[?25h');
},
deleteLine: function() {
deleteLine: function () {
isatty && process.stdout.write('\u001b[2K');
},
beginningOfLine: function() {
beginningOfLine: function () {
isatty && process.stdout.write('\u001b[0G');
},
CR: function() {
CR: function () {
if (isatty) {

@@ -176,3 +175,3 @@ exports.cursor.deleteLine();

var showDiff = (exports.showDiff = function(err) {
var showDiff = (exports.showDiff = function (err) {
return (

@@ -204,7 +203,19 @@ err &&

*/
var generateDiff = (exports.generateDiff = function(actual, expected) {
var generateDiff = (exports.generateDiff = function (actual, expected) {
try {
return exports.inlineDiffs
var maxLen = exports.maxDiffSize;
var skipped = 0;
if (maxLen > 0) {
skipped = Math.max(actual.length - maxLen, expected.length - maxLen);
actual = actual.slice(0, maxLen);
expected = expected.slice(0, maxLen);
}
let result = exports.inlineDiffs
? inlineDiff(actual, expected)
: unifiedDiff(actual, expected);
if (skipped > 0) {
result = `${result}\n [mocha] output truncated to ${maxLen} characters, see "maxDiffSize" reporter-option\n`;
}
return result;
} catch (err) {

@@ -230,6 +241,6 @@ var msg =

*/
exports.list = function(failures) {
exports.list = function (failures) {
var multipleErr, multipleTest;
Base.consoleLog();
failures.forEach(function(test, i) {
failures.forEach(function (test, i) {
// format

@@ -254,6 +265,6 @@ var fmt =

var message;
if (err.message && typeof err.message.toString === 'function') {
if (typeof err.inspect === 'function') {
message = err.inspect() + '';
} else if (err.message && typeof err.message.toString === 'function') {
message = err.message + '';
} else if (typeof err.inspect === 'function') {
message = err.inspect() + '';
} else {

@@ -294,3 +305,3 @@ message = '';

var testTitle = '';
test.titlePath().forEach(function(str, index) {
test.titlePath().forEach(function (str, index) {
if (index !== 0) {

@@ -331,3 +342,9 @@ testTitle += '\n ';

runner.on(EVENT_TEST_PASS, function(test) {
var maxDiffSizeOpt =
this.options.reporterOption && this.options.reporterOption.maxDiffSize;
if (maxDiffSizeOpt !== undefined && !isNaN(Number(maxDiffSizeOpt))) {
exports.maxDiffSize = Number(maxDiffSizeOpt);
}
runner.on(EVENT_TEST_PASS, function (test) {
if (test.duration > test.slow()) {

@@ -342,3 +359,3 @@ test.speed = 'slow';

runner.on(EVENT_TEST_FAIL, function(test, err) {
runner.on(EVENT_TEST_FAIL, function (test, err) {
if (showDiff(err)) {

@@ -363,3 +380,3 @@ stringifyDiffObjs(err);

*/
Base.prototype.epilogue = function() {
Base.prototype.epilogue = function () {
var stats = this.stats;

@@ -427,3 +444,3 @@ var fmt;

msg = lines
.map(function(str, i) {
.map(function (str, i) {
return pad(++i, width) + ' |' + ' ' + str;

@@ -485,6 +502,3 @@ })

'\n\n' +
lines
.map(cleanUp)
.filter(notBlank)
.join('\n')
lines.map(cleanUp).filter(notBlank).join('\n')
);

@@ -504,3 +518,3 @@ }

.diffWordsWithSpace(actual, expected)
.map(function(str) {
.map(function (str) {
if (str.added) {

@@ -528,3 +542,3 @@ return colorLines('diff added inline', str.value);

.split('\n')
.map(function(str) {
.map(function (str) {
return color(name, str);

@@ -531,0 +545,0 @@ })

@@ -42,3 +42,3 @@ 'use strict';

runner.on(EVENT_SUITE_BEGIN, function(suite) {
runner.on(EVENT_SUITE_BEGIN, function (suite) {
if (suite.root) {

@@ -54,3 +54,3 @@ return;

runner.on(EVENT_SUITE_END, function(suite) {
runner.on(EVENT_SUITE_END, function (suite) {
if (suite.root) {

@@ -65,3 +65,3 @@ return;

runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));

@@ -73,3 +73,3 @@ Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.file));

runner.on(EVENT_TEST_FAIL, function(test, err) {
runner.on(EVENT_TEST_FAIL, function (test, err) {
Base.consoleLog(

@@ -76,0 +76,0 @@ '%s <dt class="error">%s</dt>',

@@ -41,7 +41,7 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
process.stdout.write('\n');
});
runner.on(EVENT_TEST_PENDING, function() {
runner.on(EVENT_TEST_PENDING, function () {
if (++n % width === 0) {

@@ -53,3 +53,3 @@ process.stdout.write('\n ');

runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
if (++n % width === 0) {

@@ -65,3 +65,3 @@ process.stdout.write('\n ');

runner.on(EVENT_TEST_FAIL, function() {
runner.on(EVENT_TEST_FAIL, function () {
if (++n % width === 0) {

@@ -73,3 +73,3 @@ process.stdout.write('\n ');

runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
process.stdout.write('\n');

@@ -76,0 +76,0 @@ self.epilogue();

@@ -94,3 +94,3 @@ 'use strict';

// pass toggle
on(passesLink, 'click', function(evt) {
on(passesLink, 'click', function (evt) {
evt.preventDefault();

@@ -106,3 +106,3 @@ unhide();

// failure toggle
on(failuresLink, 'click', function(evt) {
on(failuresLink, 'click', function (evt) {
evt.preventDefault();

@@ -124,3 +124,3 @@ unhide();

runner.on(EVENT_SUITE_BEGIN, function(suite) {
runner.on(EVENT_SUITE_BEGIN, function (suite) {
if (suite.root) {

@@ -144,3 +144,3 @@ return;

runner.on(EVENT_SUITE_END, function(suite) {
runner.on(EVENT_SUITE_END, function (suite) {
if (suite.root) {

@@ -153,3 +153,3 @@ updateStats();

runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
var url = self.testURL(test);

@@ -167,3 +167,3 @@ var markup =

runner.on(EVENT_TEST_FAIL, function(test) {
runner.on(EVENT_TEST_FAIL, function (test) {
var el = fragment(

@@ -190,3 +190,3 @@ '<li class="test fail"><h2>%e <a href="%e" class="replay">' +

} else {
stackString = test.err.stack.substr(
stackString = test.err.stack.slice(
test.err.message.length + indexOfMessage

@@ -225,3 +225,3 @@ );

runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
var el = fragment(

@@ -284,3 +284,3 @@ '<li class="test pass pending"><h2>%e</h2></li>',

*/
HTML.prototype.suiteURL = function(suite) {
HTML.prototype.suiteURL = function (suite) {
return makeUrl(suite.fullTitle());

@@ -294,3 +294,3 @@ };

*/
HTML.prototype.testURL = function(test) {
HTML.prototype.testURL = function (test) {
return makeUrl(test.fullTitle());

@@ -305,6 +305,6 @@ };

*/
HTML.prototype.addCodeToggle = function(el, contents) {
HTML.prototype.addCodeToggle = function (el, contents) {
var h2 = el.getElementsByTagName('h2')[0];
on(h2, 'click', function() {
on(h2, 'click', function () {
pre.style.display = pre.style.display === 'none' ? 'block' : 'none';

@@ -337,3 +337,3 @@ });

div.innerHTML = html.replace(/%([se])/g, function(_, type) {
div.innerHTML = html.replace(/%([se])/g, function (_, type) {
switch (type) {

@@ -340,0 +340,0 @@ case 's':

@@ -38,11 +38,11 @@ 'use strict';

runner.once(EVENT_RUN_BEGIN, function() {
writeEvent(['start', {total: total}]);
runner.once(EVENT_RUN_BEGIN, function () {
writeEvent(['start', {total}]);
});
runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
writeEvent(['pass', clean(test)]);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
runner.on(EVENT_TEST_FAIL, function (test, err) {
test = clean(test);

@@ -54,3 +54,3 @@ test.err = err.message;

runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
writeEvent(['end', self.stats]);

@@ -57,0 +57,0 @@ });

@@ -10,8 +10,12 @@ 'use strict';

var Base = require('./base');
var fs = require('fs');
var path = require('path');
const createUnsupportedError = require('../errors').createUnsupportedError;
const utils = require('../utils');
var constants = require('../runner').constants;
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
var EVENT_TEST_END = constants.EVENT_TEST_END;
var EVENT_RUN_END = constants.EVENT_RUN_END;
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;

@@ -34,3 +38,3 @@ /**

*/
function JSONReporter(runner, options) {
function JSONReporter(runner, options = {}) {
Base.call(this, runner, options);

@@ -43,20 +47,28 @@

var passes = [];
var output;
runner.on(EVENT_TEST_END, function(test) {
if (options.reporterOption && options.reporterOption.output) {
if (utils.isBrowser()) {
throw createUnsupportedError('file output not supported in browser');
}
output = options.reporterOption.output;
}
runner.on(EVENT_TEST_END, function (test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
passes.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
runner.on(EVENT_TEST_FAIL, function (test) {
failures.push(test);
});
runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
pending.push(test);
});
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
var obj = {

@@ -72,3 +84,16 @@ stats: self.stats,

process.stdout.write(JSON.stringify(obj, null, 2));
var json = JSON.stringify(obj, null, 2);
if (output) {
try {
fs.mkdirSync(path.dirname(output), {recursive: true});
fs.writeFileSync(output, json);
} catch (err) {
console.error(
`${Base.symbols.err} [mocha] writing output to "${output}" failed: ${err.message}\n`
);
process.stdout.write(json);
}
} else {
process.stdout.write(json);
}
});

@@ -112,3 +137,3 @@ }

return JSON.parse(
JSON.stringify(obj, function(key, value) {
JSON.stringify(obj, function (key, value) {
if (typeof value === 'object' && value !== null) {

@@ -136,3 +161,3 @@ if (cache.indexOf(value) !== -1) {

var res = {};
Object.getOwnPropertyNames(err).forEach(function(key) {
Object.getOwnPropertyNames(err).forEach(function (key) {
res[key] = err[key];

@@ -139,0 +164,0 @@ }, err);

@@ -71,3 +71,3 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
stream.write('\n\n\n ');

@@ -77,3 +77,3 @@ cursor.hide();

runner.on(EVENT_TEST_END, function(test) {
runner.on(EVENT_TEST_END, function (test) {
// check if the plane crashed

@@ -98,3 +98,3 @@ var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed;

runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
cursor.show();

@@ -106,5 +106,5 @@ process.stdout.write('\n');

// if cursor is hidden when we ctrl-C, then it will remain hidden unless...
process.once('SIGINT', function() {
process.once('SIGINT', function () {
cursor.show();
process.nextTick(function() {
process.nextTick(function () {
process.kill(process.pid, 'SIGINT');

@@ -111,0 +111,0 @@ });

@@ -43,11 +43,11 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
Base.consoleLog();
});
runner.on(EVENT_TEST_BEGIN, function(test) {
runner.on(EVENT_TEST_BEGIN, function (test) {
process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
});
runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
var fmt = color('checkmark', ' -') + color('pending', ' %s');

@@ -57,3 +57,3 @@ Base.consoleLog(fmt, test.fullTitle());

runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
var fmt =

@@ -67,3 +67,3 @@ color('checkmark', ' ' + Base.symbols.ok) +

runner.on(EVENT_TEST_FAIL, function(test) {
runner.on(EVENT_TEST_FAIL, function (test) {
cursor.CR();

@@ -70,0 +70,0 @@ Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());

@@ -53,4 +53,4 @@ 'use strict';

obj = obj[key] = obj[key] || {suite: suite};
suite.suites.forEach(function(suite) {
obj = obj[key] = obj[key] || {suite};
suite.suites.forEach(function (suite) {
mapTOC(suite, obj);

@@ -87,3 +87,3 @@ });

runner.on(EVENT_SUITE_BEGIN, function(suite) {
runner.on(EVENT_SUITE_BEGIN, function (suite) {
++level;

@@ -95,7 +95,7 @@ var slug = utils.slug(suite.fullTitle());

runner.on(EVENT_SUITE_END, function() {
runner.on(EVENT_SUITE_END, function () {
--level;
});
runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
var code = utils.clean(test.body);

@@ -108,3 +108,3 @@ buf += test.title + '.\n';

runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
process.stdout.write('# TOC\n');

@@ -111,0 +111,0 @@ process.stdout.write(generateTOC(runner.suite));

@@ -37,3 +37,3 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
// clear screen

@@ -40,0 +40,0 @@ process.stdout.write('\u001b[2J');

@@ -49,3 +49,3 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
Base.cursor.hide();

@@ -55,15 +55,15 @@ self.draw();

runner.on(EVENT_TEST_PENDING, function() {
runner.on(EVENT_TEST_PENDING, function () {
self.draw();
});
runner.on(EVENT_TEST_PASS, function() {
runner.on(EVENT_TEST_PASS, function () {
self.draw();
});
runner.on(EVENT_TEST_FAIL, function() {
runner.on(EVENT_TEST_FAIL, function () {
self.draw();
});
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
Base.cursor.show();

@@ -88,3 +88,3 @@ for (var i = 0; i < self.numberOfLines; i++) {

NyanCat.prototype.draw = function() {
NyanCat.prototype.draw = function () {
this.appendRainbow();

@@ -104,3 +104,3 @@ this.drawScoreboard();

NyanCat.prototype.drawScoreboard = function() {
NyanCat.prototype.drawScoreboard = function () {
var stats = this.stats;

@@ -128,3 +128,3 @@

NyanCat.prototype.appendRainbow = function() {
NyanCat.prototype.appendRainbow = function () {
var segment = this.tick ? '_' : '-';

@@ -148,6 +148,6 @@ var rainbowified = this.rainbowify(segment);

NyanCat.prototype.drawRainbow = function() {
NyanCat.prototype.drawRainbow = function () {
var self = this;
this.trajectories.forEach(function(line) {
this.trajectories.forEach(function (line) {
write('\u001b[' + self.scoreboardWidth + 'C');

@@ -166,3 +166,3 @@ write(line.join(''));

*/
NyanCat.prototype.drawNyanCat = function() {
NyanCat.prototype.drawNyanCat = function () {
var self = this;

@@ -203,3 +203,3 @@ var startWidth = this.scoreboardWidth + this.trajectories[0].length;

NyanCat.prototype.face = function() {
NyanCat.prototype.face = function () {
var stats = this.stats;

@@ -223,3 +223,3 @@ if (stats.failures) {

NyanCat.prototype.cursorUp = function(n) {
NyanCat.prototype.cursorUp = function (n) {
write('\u001b[' + n + 'A');

@@ -235,3 +235,3 @@ };

NyanCat.prototype.cursorDown = function(n) {
NyanCat.prototype.cursorDown = function (n) {
write('\u001b[' + n + 'B');

@@ -246,3 +246,3 @@ };

*/
NyanCat.prototype.generateColors = function() {
NyanCat.prototype.generateColors = function () {
var colors = [];

@@ -269,3 +269,3 @@

*/
NyanCat.prototype.rainbowify = function(str) {
NyanCat.prototype.rainbowify = function (str) {
if (!Base.useColors) {

@@ -272,0 +272,0 @@ return str;

@@ -60,3 +60,3 @@ 'use strict';

// tests started
runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
process.stdout.write('\n');

@@ -67,3 +67,3 @@ cursor.hide();

// tests complete
runner.on(EVENT_TEST_END, function() {
runner.on(EVENT_TEST_END, function () {
complete++;

@@ -94,3 +94,3 @@

// and the failures if any
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
cursor.show();

@@ -97,0 +97,0 @@ process.stdout.write('\n');

@@ -48,7 +48,7 @@ 'use strict';

runner.on(EVENT_RUN_BEGIN, function() {
runner.on(EVENT_RUN_BEGIN, function () {
Base.consoleLog();
});
runner.on(EVENT_SUITE_BEGIN, function(suite) {
runner.on(EVENT_SUITE_BEGIN, function (suite) {
++indents;

@@ -58,3 +58,3 @@ Base.consoleLog(color('suite', '%s%s'), indent(), suite.title);

runner.on(EVENT_SUITE_END, function() {
runner.on(EVENT_SUITE_END, function () {
--indents;

@@ -66,3 +66,3 @@ if (indents === 1) {

runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
var fmt = indent() + color('pending', ' - %s');

@@ -72,3 +72,3 @@ Base.consoleLog(fmt, test.title);

runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
var fmt;

@@ -91,3 +91,3 @@ if (test.speed === 'fast') {

runner.on(EVENT_TEST_FAIL, function(test) {
runner.on(EVENT_TEST_FAIL, function (test) {
Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);

@@ -94,0 +94,0 @@ });

@@ -52,23 +52,23 @@ 'use strict';

runner.once(EVENT_RUN_BEGIN, function() {
runner.once(EVENT_RUN_BEGIN, function () {
self._producer.writeVersion();
});
runner.on(EVENT_TEST_END, function() {
runner.on(EVENT_TEST_END, function () {
++n;
});
runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
self._producer.writePending(n, test);
});
runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
self._producer.writePass(n, test);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
runner.on(EVENT_TEST_FAIL, function (test, err) {
self._producer.writeFail(n, test, err);
});
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
self._producer.writeEpilogue(runner.stats);

@@ -117,4 +117,4 @@ });

var producers = {
'12': new TAP12Producer(),
'13': new TAP13Producer()
12: new TAP12Producer(),
13: new TAP13Producer()
};

@@ -149,3 +149,3 @@ var producer = producers[tapVersion];

*/
TAPProducer.prototype.writeVersion = function() {};
TAPProducer.prototype.writeVersion = function () {};

@@ -158,3 +158,3 @@ /**

*/
TAPProducer.prototype.writePlan = function(ntests) {
TAPProducer.prototype.writePlan = function (ntests) {
println('%d..%d', 1, ntests);

@@ -170,3 +170,3 @@ };

*/
TAPProducer.prototype.writePass = function(n, test) {
TAPProducer.prototype.writePass = function (n, test) {
println('ok %d %s', n, title(test));

@@ -182,3 +182,3 @@ };

*/
TAPProducer.prototype.writePending = function(n, test) {
TAPProducer.prototype.writePending = function (n, test) {
println('ok %d %s # SKIP -', n, title(test));

@@ -195,3 +195,3 @@ };

*/
TAPProducer.prototype.writeFail = function(n, test, err) {
TAPProducer.prototype.writeFail = function (n, test, err) {
println('not ok %d %s', n, title(test));

@@ -206,3 +206,3 @@ };

*/
TAPProducer.prototype.writeEpilogue = function(stats) {
TAPProducer.prototype.writeEpilogue = function (stats) {
// :TBD: Why is this not counting pending tests?

@@ -233,3 +233,3 @@ println('# tests ' + (stats.passes + stats.failures));

*/
this.writeFail = function(n, test, err) {
this.writeFail = function (n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);

@@ -267,3 +267,3 @@ if (err.message) {

*/
this.writeVersion = function() {
this.writeVersion = function () {
println('TAP version 13');

@@ -276,3 +276,3 @@ };

*/
this.writeFail = function(n, test, err) {
this.writeFail = function (n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);

@@ -279,0 +279,0 @@ var emitYamlBlock = err.message != null || err.stack != null;

@@ -77,15 +77,15 @@ 'use strict';

runner.on(EVENT_TEST_PENDING, function(test) {
runner.on(EVENT_TEST_PENDING, function (test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
runner.on(EVENT_TEST_PASS, function (test) {
tests.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
runner.on(EVENT_TEST_FAIL, function (test) {
tests.push(test);
});
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
self.write(

@@ -107,3 +107,3 @@ tag(

tests.forEach(function(t) {
tests.forEach(function (t) {
self.test(t);

@@ -127,5 +127,5 @@ });

*/
XUnit.prototype.done = function(failures, fn) {
XUnit.prototype.done = function (failures, fn) {
if (this.fileStream) {
this.fileStream.end(function() {
this.fileStream.end(function () {
fn(failures);

@@ -143,3 +143,3 @@ });

*/
XUnit.prototype.write = function(line) {
XUnit.prototype.write = function (line) {
if (this.fileStream) {

@@ -159,3 +159,3 @@ this.fileStream.write(line + '\n');

*/
XUnit.prototype.test = function(test) {
XUnit.prototype.test = function (test) {
Base.useColors = false;

@@ -162,0 +162,0 @@

@@ -60,3 +60,3 @@ 'use strict';

*/
Runnable.prototype.reset = function() {
Runnable.prototype.reset = function () {
this.timedOut = false;

@@ -90,3 +90,3 @@ this._currentRetry = 0;

*/
Runnable.prototype.timeout = function(ms) {
Runnable.prototype.timeout = function (ms) {
if (!arguments.length) {

@@ -125,3 +125,3 @@ return this._timeout;

*/
Runnable.prototype.slow = function(ms) {
Runnable.prototype.slow = function (ms) {
if (!arguments.length || typeof ms === 'undefined') {

@@ -144,3 +144,3 @@ return this._slow;

*/
Runnable.prototype.skip = function() {
Runnable.prototype.skip = function () {
this.pending = true;

@@ -155,3 +155,3 @@ throw new Pending('sync skip; aborting execution');

*/
Runnable.prototype.isPending = function() {
Runnable.prototype.isPending = function () {
return this.pending || (this.parent && this.parent.isPending());

@@ -165,3 +165,3 @@ };

*/
Runnable.prototype.isFailed = function() {
Runnable.prototype.isFailed = function () {
return !this.isPending() && this.state === constants.STATE_FAILED;

@@ -175,3 +175,3 @@ };

*/
Runnable.prototype.isPassed = function() {
Runnable.prototype.isPassed = function () {
return !this.isPending() && this.state === constants.STATE_PASSED;

@@ -185,3 +185,3 @@ };

*/
Runnable.prototype.retries = function(n) {
Runnable.prototype.retries = function (n) {
if (!arguments.length) {

@@ -198,3 +198,3 @@ return this._retries;

*/
Runnable.prototype.currentRetry = function(n) {
Runnable.prototype.currentRetry = function (n) {
if (!arguments.length) {

@@ -214,3 +214,3 @@ return this._currentRetry;

*/
Runnable.prototype.fullTitle = function() {
Runnable.prototype.fullTitle = function () {
return this.titlePath().join(' ');

@@ -226,3 +226,3 @@ };

*/
Runnable.prototype.titlePath = function() {
Runnable.prototype.titlePath = function () {
return this.parent.titlePath().concat([this.title]);

@@ -236,3 +236,3 @@ };

*/
Runnable.prototype.clearTimeout = function() {
Runnable.prototype.clearTimeout = function () {
clearTimeout(this.timer);

@@ -246,3 +246,3 @@ };

*/
Runnable.prototype.resetTimeout = function() {
Runnable.prototype.resetTimeout = function () {
var self = this;

@@ -255,3 +255,3 @@ var ms = this.timeout();

this.clearTimeout();
this.timer = setTimeout(function() {
this.timer = setTimeout(function () {
if (self.timeout() === 0) {

@@ -271,3 +271,3 @@ return;

*/
Runnable.prototype.globals = function(globals) {
Runnable.prototype.globals = function (globals) {
if (!arguments.length) {

@@ -285,3 +285,3 @@ return this._allowedGlobals;

*/
Runnable.prototype.run = function(fn) {
Runnable.prototype.run = function (fn) {
var self = this;

@@ -386,3 +386,3 @@ var start = new Date();

result.then(
function() {
function () {
done();

@@ -393,3 +393,3 @@ // Return null so libraries like bluebird do not warn about

},
function(reason) {
function (reason) {
done(reason || new Error('Promise rejected with no or falsy reason'));

@@ -412,3 +412,3 @@ }

function callFnAsync(fn) {
var result = fn.call(ctx, function(err) {
var result = fn.call(ctx, function (err) {
if (err instanceof Error || toString.call(err) === '[object Error]') {

@@ -445,3 +445,3 @@ return done(err);

*/
Runnable.prototype._timeoutError = function(ms) {
Runnable.prototype._timeoutError = function (ms) {
let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;

@@ -486,3 +486,3 @@ if (this.file) {

*/
Runnable.toValueOrError = function(value) {
Runnable.toValueOrError = function (value) {
return (

@@ -489,0 +489,0 @@ value ||

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

*/
var util = require('util');
var EventEmitter = require('events').EventEmitter;

@@ -23,4 +22,2 @@ var Pending = require('./pending');

var STATE_PENDING = Runnable.constants.STATE_PENDING;
var dQuote = utils.dQuote;
var sQuote = utils.sQuote;
var stackFilter = utils.stackTraceFilter();

@@ -143,18 +140,11 @@ var stringify = utils.stringify;

* @param {Suite} suite - Root suite
* @param {Object|boolean} [opts] - Options. If `boolean`, whether or not to delay execution of root suite until ready (for backwards compatibility).
* @param {Object} [opts] - Settings object
* @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
* @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
* @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
* @param {boolean} [opts.dryRun] - Whether to report tests without running them.
* @param {boolean} [opts.failZero] - Whether to fail test run if zero tests encountered.
*/
constructor(suite, opts) {
constructor(suite, opts = {}) {
super();
if (opts === undefined) {
opts = {};
}
if (typeof opts === 'boolean') {
// TODO: deprecate this
this._delay = opts;
opts = {};
} else {
this._delay = opts.delay;
}
var self = this;

@@ -172,3 +162,3 @@ this._globals = [];

this._eventListeners = new Map();
this.on(constants.EVENT_TEST_END, function(test) {
this.on(constants.EVENT_TEST_END, function (test) {
if (test.type === 'test' && test.retriedTest() && test.parent) {

@@ -181,3 +171,3 @@ var idx =

});
this.on(constants.EVENT_HOOK_END, function(hook) {
this.on(constants.EVENT_HOOK_END, function (hook) {
self.checkGlobals(hook);

@@ -231,3 +221,3 @@ });

*/
Runner.prototype._addEventListener = function(target, eventName, listener) {
Runner.prototype._addEventListener = function (target, eventName, listener) {
debug(

@@ -242,6 +232,3 @@ '_addEventListener(): adding for event %s; %d current listeners',

this._eventListeners.get(target).has(eventName) &&
this._eventListeners
.get(target)
.get(eventName)
.has(listener)
this._eventListeners.get(target).get(eventName).has(listener)
) {

@@ -273,3 +260,3 @@ debug(

*/
Runner.prototype._removeEventListener = function(target, eventName, listener) {
Runner.prototype._removeEventListener = function (target, eventName, listener) {
target.removeListener(eventName, listener);

@@ -298,3 +285,3 @@

*/
Runner.prototype.dispose = function() {
Runner.prototype.dispose = function () {
this.removeAllListeners();

@@ -321,3 +308,3 @@ this._eventListeners.forEach((targetListeners, target) => {

*/
Runner.prototype.grep = function(re, invert) {
Runner.prototype.grep = function (re, invert) {
debug('grep(): setting to %s', re);

@@ -339,7 +326,7 @@ this._grep = re;

*/
Runner.prototype.grepTotal = function(suite) {
Runner.prototype.grepTotal = function (suite) {
var self = this;
var total = 0;
suite.eachTest(function(test) {
suite.eachTest(function (test) {
var match = self._grep.test(test.fullTitle());

@@ -363,3 +350,3 @@ if (self._invert) {

*/
Runner.prototype.globalProps = function() {
Runner.prototype.globalProps = function () {
var props = Object.keys(global);

@@ -386,3 +373,3 @@

*/
Runner.prototype.globals = function(arr) {
Runner.prototype.globals = function (arr) {
if (!arguments.length) {

@@ -401,3 +388,3 @@ return this._globals;

*/
Runner.prototype.checkGlobals = function(test) {
Runner.prototype.checkGlobals = function (test) {
if (!this.checkLeaks) {

@@ -424,5 +411,4 @@ return;

if (leaks.length) {
var msg = 'global leak(s) detected: %s';
var error = new Error(util.format(msg, leaks.map(sQuote).join(', ')));
this.fail(test, error);
var msg = `global leak(s) detected: ${leaks.map(e => `'${e}'`).join(', ')}`;
this.fail(test, new Error(msg));
}

@@ -452,3 +438,3 @@ };

*/
Runner.prototype.fail = function(test, err, force) {
Runner.prototype.fail = function (test, err, force) {
force = force === true;

@@ -494,3 +480,5 @@ if (test.isPending() && !force) {

Runner.prototype.hook = function(name, fn) {
Runner.prototype.hook = function (name, fn) {
if (this._opts.dryRun) return fn();
var suite = this.suite;

@@ -522,3 +510,3 @@ var hooks = suite.getHooks(name);

if (!hook.listeners('error').length) {
self._addEventListener(hook, 'error', function(err) {
self._addEventListener(hook, 'error', function (err) {
self.fail(hook, err);

@@ -548,6 +536,6 @@ });

} else if (name === HOOK_TYPE_BEFORE_ALL) {
suite.tests.forEach(function(test) {
suite.tests.forEach(function (test) {
test.pending = true;
});
suite.suites.forEach(function(suite) {
suite.suites.forEach(function (suite) {
suite.pending = true;

@@ -576,4 +564,3 @@ });

if (hook.ctx && hook.ctx.currentTest) {
hook.title =
hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
hook.title = `${hook.originalTitle} for "${hook.ctx.currentTest.title}"`;
} else {

@@ -586,3 +573,3 @@ var parentTitle;

}
hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
hook.title = `${hook.originalTitle} in "${parentTitle}"`;
}

@@ -592,3 +579,3 @@ }

Runner.immediately(function() {
Runner.immediately(function () {
next(0);

@@ -607,3 +594,3 @@ });

*/
Runner.prototype.hooks = function(name, suites, fn) {
Runner.prototype.hooks = function (name, suites, fn) {
var self = this;

@@ -620,3 +607,3 @@ var orig = this.suite;

self.hook(name, function(err) {
self.hook(name, function (err) {
if (err) {

@@ -636,3 +623,3 @@ var errSuite = self.suite;

/**
* Run hooks from the top level down.
* Run 'afterEach' hooks from bottom up.
*

@@ -643,3 +630,3 @@ * @param {String} name

*/
Runner.prototype.hookUp = function(name, fn) {
Runner.prototype.hookUp = function (name, fn) {
var suites = [this.suite].concat(this.parents()).reverse();

@@ -650,3 +637,3 @@ this.hooks(name, suites, fn);

/**
* Run hooks from the bottom up.
* Run 'beforeEach' hooks from top level down.
*

@@ -657,3 +644,3 @@ * @param {String} name

*/
Runner.prototype.hookDown = function(name, fn) {
Runner.prototype.hookDown = function (name, fn) {
var suites = [this.suite].concat(this.parents());

@@ -670,3 +657,3 @@ this.hooks(name, suites, fn);

*/
Runner.prototype.parents = function() {
Runner.prototype.parents = function () {
var suite = this.suite;

@@ -687,3 +674,5 @@ var suites = [];

*/
Runner.prototype.runTest = function(fn) {
Runner.prototype.runTest = function (fn) {
if (this._opts.dryRun) return Runner.immediately(fn);
var self = this;

@@ -699,3 +688,3 @@ var test = this.test;

}
this._addEventListener(test, 'error', function(err) {
this._addEventListener(test, 'error', function (err) {
self.fail(test, err);

@@ -721,3 +710,3 @@ });

*/
Runner.prototype.runTests = function(suite, fn) {
Runner.prototype.runTests = function (suite, fn) {
var self = this;

@@ -736,4 +725,3 @@ var tests = suite.tests.slice();

if (self.suite) {
// call hookUp afterEach
self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
self.hookUp(HOOK_TYPE_AFTER_EACH, function (err2, errSuite2) {
self.suite = orig;

@@ -812,3 +800,3 @@ // some hooks may fail even now

self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
self.hookDown(HOOK_TYPE_BEFORE_EACH, function (err, errSuite) {
// conditional skip within beforeEach

@@ -826,3 +814,3 @@ if (test.isPending()) {

self.suite = errSuite || self.suite;
return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
return self.hookUp(HOOK_TYPE_AFTER_EACH, function (e, eSuite) {
self.suite = origSuite;

@@ -836,3 +824,3 @@ next(e, eSuite);

self.currentRunnable = self.test;
self.runTest(function(err) {
self.runTest(function (err) {
test = self.test;

@@ -888,3 +876,3 @@ // conditional skip within it

*/
Runner.prototype.runSuite = function(suite, fn) {
Runner.prototype.runSuite = function (suite, fn) {
var i = 0;

@@ -929,3 +917,3 @@ var self = this;

if (self._grep !== self._defaultGrep) {
Runner.immediately(function() {
Runner.immediately(function () {
self.runSuite(curr, next);

@@ -945,3 +933,3 @@ });

self.hook(HOOK_TYPE_AFTER_ALL, function() {
self.hook(HOOK_TYPE_AFTER_ALL, function () {
self.emit(constants.EVENT_SUITE_END, suite);

@@ -954,3 +942,3 @@ fn(errSuite);

this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
this.hook(HOOK_TYPE_BEFORE_ALL, function (err) {
if (err) {

@@ -979,3 +967,3 @@ return done();

*/
Runner.prototype._uncaught = function(err) {
Runner.prototype._uncaught = function (err) {
// this is defensive to prevent future developers from mis-calling this function.

@@ -1075,6 +1063,8 @@ // it's more likely that it'd be called with the incorrect context--say, the global

* @param {Function} fn - Callback when finished
* @param {{files: string[], options: Options}} [opts] - For subclasses
* @param {Object} [opts] - For subclasses
* @param {string[]} opts.files - Files to run
* @param {Options} opts.options - command-line options
* @returns {Runner} Runner instance.
*/
Runner.prototype.run = function(fn, opts = {}) {
Runner.prototype.run = function (fn, opts = {}) {
var rootSuite = this.suite;

@@ -1084,5 +1074,7 @@ var options = opts.options || {};

debug('run(): got options: %O', options);
fn = fn || function() {};
fn = fn || function () {};
const end = () => {
if (!this.total && this._opts.failZero) this.failures = 1;
debug('run(): root suite completed; emitting %s', constants.EVENT_RUN_END);

@@ -1108,3 +1100,3 @@ this.emit(constants.EVENT_RUN_END);

this.state = constants.STATE_RUNNING;
if (this._delay) {
if (this._opts.delay) {
this.emit(constants.EVENT_DELAY_END);

@@ -1125,3 +1117,3 @@ debug('run(): "delay" ended');

// callback
this.on(constants.EVENT_RUN_END, function() {
this.on(constants.EVENT_RUN_END, function () {
this.state = constants.STATE_STOPPED;

@@ -1137,3 +1129,3 @@ debug('run(): emitted %s', constants.EVENT_RUN_END);

if (this._delay) {
if (this._opts.delay) {
// for reporters, I guess.

@@ -1174,3 +1166,3 @@ // might be nice to debounce some dots while we wait.

*/
Runner.prototype.linkPartialObjects = function(value) {
Runner.prototype.linkPartialObjects = function (value) {
return this;

@@ -1200,3 +1192,3 @@ };

*/
Runner.prototype.abort = function() {
Runner.prototype.abort = function () {
debug('abort(): aborting');

@@ -1229,3 +1221,3 @@ this._abort = true;

*/
Runner.prototype.workerReporter = function() {
Runner.prototype.workerReporter = function () {
throw createUnsupportedError('workerReporter() not supported in serial mode');

@@ -1243,3 +1235,3 @@ };

function filterLeaks(ok, globals) {
return globals.filter(function(key) {
return globals.filter(function (key) {
// Firefox and Chrome exposes iframes as index inside the window object

@@ -1268,3 +1260,3 @@ if (/^\d+/.test(key)) {

var matched = ok.filter(function(ok) {
var matched = ok.filter(function (ok) {
if (~ok.indexOf('*')) {

@@ -1271,0 +1263,0 @@ return key.indexOf(ok.split('*')[0]) === 0;

@@ -59,21 +59,21 @@ 'use strict';

runner.once(EVENT_RUN_BEGIN, function() {
runner.once(EVENT_RUN_BEGIN, function () {
stats.start = new Date();
});
runner.on(EVENT_SUITE_BEGIN, function(suite) {
runner.on(EVENT_SUITE_BEGIN, function (suite) {
suite.root || stats.suites++;
});
runner.on(EVENT_TEST_PASS, function() {
runner.on(EVENT_TEST_PASS, function () {
stats.passes++;
});
runner.on(EVENT_TEST_FAIL, function() {
runner.on(EVENT_TEST_FAIL, function () {
stats.failures++;
});
runner.on(EVENT_TEST_PENDING, function() {
runner.on(EVENT_TEST_PENDING, function () {
stats.pending++;
});
runner.on(EVENT_TEST_END, function() {
runner.on(EVENT_TEST_END, function () {
stats.tests++;
});
runner.once(EVENT_RUN_END, function() {
runner.once(EVENT_RUN_END, function () {
stats.end = new Date();

@@ -80,0 +80,0 @@ stats.duration = stats.end - stats.start;

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

constants: utilsConstants,
createMap,
defineConstants,

@@ -40,3 +39,3 @@ getMochaID,

*/
Suite.create = function(parent, title) {
Suite.create = function (parent, title) {
var suite = new Suite(title, parent.ctx);

@@ -97,12 +96,2 @@ suite.parent = parent;

this.reset();
this.on('newListener', function(event) {
if (deprecatedEvents[event]) {
errors.deprecate(
'Event "' +
event +
'" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
);
}
});
}

@@ -118,3 +107,3 @@

*/
Suite.prototype.reset = function() {
Suite.prototype.reset = function () {
this.delayed = false;

@@ -138,3 +127,3 @@ function doReset(thingToReset) {

*/
Suite.prototype.clone = function() {
Suite.prototype.clone = function () {
var suite = new Suite(this.title);

@@ -159,3 +148,3 @@ debug('clone');

*/
Suite.prototype.timeout = function(ms) {
Suite.prototype.timeout = function (ms) {
if (!arguments.length) {

@@ -185,3 +174,3 @@ return this._timeout;

*/
Suite.prototype.retries = function(n) {
Suite.prototype.retries = function (n) {
if (!arguments.length) {

@@ -202,3 +191,3 @@ return this._retries;

*/
Suite.prototype.slow = function(ms) {
Suite.prototype.slow = function (ms) {
if (!arguments.length) {

@@ -222,3 +211,3 @@ return this._slow;

*/
Suite.prototype.bail = function(bail) {
Suite.prototype.bail = function (bail) {
if (!arguments.length) {

@@ -237,3 +226,3 @@ return this._bail;

*/
Suite.prototype.isPending = function() {
Suite.prototype.isPending = function () {
return this.pending || (this.parent && this.parent.isPending());

@@ -249,3 +238,3 @@ };

*/
Suite.prototype._createHook = function(title, fn) {
Suite.prototype._createHook = function (title, fn) {
var hook = new Hook(title, fn);

@@ -269,3 +258,3 @@ hook.parent = this;

*/
Suite.prototype.beforeAll = function(title, fn) {
Suite.prototype.beforeAll = function (title, fn) {
if (this.isPending()) {

@@ -294,3 +283,3 @@ return this;

*/
Suite.prototype.afterAll = function(title, fn) {
Suite.prototype.afterAll = function (title, fn) {
if (this.isPending()) {

@@ -319,3 +308,3 @@ return this;

*/
Suite.prototype.beforeEach = function(title, fn) {
Suite.prototype.beforeEach = function (title, fn) {
if (this.isPending()) {

@@ -344,3 +333,3 @@ return this;

*/
Suite.prototype.afterEach = function(title, fn) {
Suite.prototype.afterEach = function (title, fn) {
if (this.isPending()) {

@@ -368,3 +357,3 @@ return this;

*/
Suite.prototype.addSuite = function(suite) {
Suite.prototype.addSuite = function (suite) {
suite.parent = this;

@@ -388,3 +377,3 @@ suite.root = false;

*/
Suite.prototype.addTest = function(test) {
Suite.prototype.addTest = function (test) {
test.parent = this;

@@ -408,3 +397,3 @@ test.timeout(this.timeout());

*/
Suite.prototype.fullTitle = function() {
Suite.prototype.fullTitle = function () {
return this.titlePath().join(' ');

@@ -421,3 +410,3 @@ };

*/
Suite.prototype.titlePath = function() {
Suite.prototype.titlePath = function () {
var result = [];

@@ -440,5 +429,5 @@ if (this.parent) {

*/
Suite.prototype.total = function() {
Suite.prototype.total = function () {
return (
this.suites.reduce(function(sum, suite) {
this.suites.reduce(function (sum, suite) {
return sum + suite.total();

@@ -457,5 +446,5 @@ }, 0) + this.tests.length

*/
Suite.prototype.eachTest = function(fn) {
Suite.prototype.eachTest = function (fn) {
this.tests.forEach(fn);
this.suites.forEach(function(suite) {
this.suites.forEach(function (suite) {
suite.eachTest(fn);

@@ -486,3 +475,3 @@ });

this._onlySuites.length > 0 ||
this.suites.some(function(suite) {
this.suites.some(function (suite) {
return suite.hasOnly();

@@ -507,3 +496,3 @@ })

this.tests = [];
this._onlySuites.forEach(function(onlySuite) {
this._onlySuites.forEach(function (onlySuite) {
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.

@@ -517,3 +506,3 @@ // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.

var onlySuites = this._onlySuites;
this.suites = this.suites.filter(function(childSuite) {
this.suites = this.suites.filter(function (childSuite) {
return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();

@@ -532,3 +521,3 @@ });

*/
Suite.prototype.appendOnlySuite = function(suite) {
Suite.prototype.appendOnlySuite = function (suite) {
this._onlySuites.push(suite);

@@ -542,3 +531,3 @@ };

*/
Suite.prototype.markOnly = function() {
Suite.prototype.markOnly = function () {
this.parent && this.parent.appendOnlySuite(this);

@@ -553,3 +542,3 @@ };

*/
Suite.prototype.appendOnlyTest = function(test) {
Suite.prototype.appendOnlyTest = function (test) {
this._onlyTests.push(test);

@@ -569,4 +558,4 @@ };

*/
Suite.prototype.dispose = function() {
this.suites.forEach(function(suite) {
Suite.prototype.dispose = function () {
this.suites.forEach(function (suite) {
suite.dispose();

@@ -625,6 +614,6 @@ });

$$fullTitle: this.fullTitle(),
$$isPending: this.isPending(),
$$isPending: Boolean(this.isPending()),
root: this.root,
title: this.title,
id: this.id,
[MOCHA_ID_PROP_NAME]: this.id,
parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null

@@ -646,3 +635,3 @@ };

/**
* Event emitted after a test file has been loaded Not emitted in browser.
* Event emitted after a test file has been loaded. Not emitted in browser.
*/

@@ -659,3 +648,3 @@ EVENT_FILE_POST_REQUIRE: 'post-require',

/**
* Event emitted when `global.run()` is called (use with `delay` option)
* Event emitted when `global.run()` is called (use with `delay` option).
*/

@@ -665,43 +654,41 @@ EVENT_ROOT_SUITE_RUN: 'run',

/**
* Namespace for collection of a `Suite`'s "after all" hooks
* Namespace for collection of a `Suite`'s "after all" hooks.
*/
HOOK_TYPE_AFTER_ALL: 'afterAll',
/**
* Namespace for collection of a `Suite`'s "after each" hooks
* Namespace for collection of a `Suite`'s "after each" hooks.
*/
HOOK_TYPE_AFTER_EACH: 'afterEach',
/**
* Namespace for collection of a `Suite`'s "before all" hooks
* Namespace for collection of a `Suite`'s "before all" hooks.
*/
HOOK_TYPE_BEFORE_ALL: 'beforeAll',
/**
* Namespace for collection of a `Suite`'s "before all" hooks
* Namespace for collection of a `Suite`'s "before each" hooks.
*/
HOOK_TYPE_BEFORE_EACH: 'beforeEach',
// the following events are all deprecated
/**
* Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
* Emitted after a child `Suite` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_SUITE: 'suite',
/**
* Emitted after an "after all" `Hook` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
/**
* Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
* Emitted after an "after each" `Hook` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
/**
* Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
* Emitted after an "before all" `Hook` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
/**
* Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
* Emitted after an "before each" `Hook` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
/**
* Emitted after a child `Suite` has been added to a `Suite`. Deprecated
* Emitted after a `Test` has been added to a `Suite`.
*/
EVENT_SUITE_ADD_SUITE: 'suite',
/**
* Emitted after a `Test` has been added to a `Suite`. Deprecated
*/
EVENT_SUITE_ADD_TEST: 'test'

@@ -711,18 +698,2 @@ }

/**
* @summary There are no known use cases for these events.
* @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
* @todo Remove eventually
* @type {Object<string,boolean>}
* @ignore
*/
var deprecatedEvents = Object.keys(constants)
.filter(function(constant) {
return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
})
.reduce(function(acc, constant) {
acc[constants[constant]] = true;
return acc;
}, createMap());
Suite.constants = constants;

@@ -44,3 +44,3 @@ 'use strict';

*/
Test.prototype.reset = function() {
Test.prototype.reset = function () {
Runnable.prototype.reset.call(this);

@@ -56,3 +56,3 @@ this.pending = !this.fn;

*/
Test.prototype.retriedTest = function(n) {
Test.prototype.retriedTest = function (n) {
if (!arguments.length) {

@@ -69,7 +69,7 @@ return this._retriedTest;

*/
Test.prototype.markOnly = function() {
Test.prototype.markOnly = function () {
this.parent.appendOnlyTest(this);
};
Test.prototype.clone = function() {
Test.prototype.clone = function () {
var test = new Test(this.title, this.fn);

@@ -98,3 +98,3 @@ test.timeout(this.timeout());

$$fullTitle: this.fullTitle(),
$$isPending: this.pending,
$$isPending: Boolean(this.pending),
$$retriedTest: this._retriedTest || null,

@@ -101,0 +101,0 @@ $$slow: this._slow,

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

var he = require('he');
const errors = require('./errors');

@@ -39,3 +38,3 @@ const MOCHA_ID_PROP_NAME = '__mocha_id__';

*/
exports.escape = function(html) {
exports.escape = function (html) {
return he.encode(String(html), {useNamedReferences: false});

@@ -51,3 +50,3 @@ };

*/
exports.isString = function(obj) {
exports.isString = function (obj) {
return typeof obj === 'string';

@@ -63,3 +62,3 @@ };

*/
exports.slug = function(str) {
exports.slug = function (str) {
return str

@@ -78,3 +77,3 @@ .toLowerCase()

*/
exports.clean = function(str) {
exports.clean = function (str) {
str = str

@@ -85,3 +84,3 @@ .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')

.replace(
/^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
/^function(?:\s*|\s[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\}|((?:.|\n)*))$/,
'$1$2$3'

@@ -222,3 +221,3 @@ );

*/
exports.stringify = function(value) {
exports.stringify = function (value) {
var typeHint = canonicalType(value);

@@ -239,3 +238,3 @@

if (typeHint === 'string' && typeof value === 'object') {
value = value.split('').reduce(function(acc, char, idx) {
value = value.split('').reduce(function (acc, char, idx) {
acc[idx] = char;

@@ -395,4 +394,4 @@ return acc;

case 'array':
withStack(value, function() {
canonicalizedObj = value.map(function(item) {
withStack(value, function () {
canonicalizedObj = value.map(function (item) {
return exports.canonicalize(item, stack);

@@ -403,3 +402,3 @@ });

case 'function':
/* eslint-disable-next-line no-unused-vars */
/* eslint-disable-next-line no-unused-vars, no-unreachable-loop */
for (prop in value) {

@@ -417,6 +416,6 @@ canonicalizedObj = {};

canonicalizedObj = canonicalizedObj || {};
withStack(value, function() {
withStack(value, function () {
Object.keys(value)
.sort()
.forEach(function(key) {
.forEach(function (key) {
canonicalizedObj[key] = exports.canonicalize(value[key], stack);

@@ -449,3 +448,3 @@ });

*/
exports.stackTraceFilter = function() {
exports.stackTraceFilter = function () {
// TODO: Replace with `process.browser`

@@ -458,5 +457,4 @@ var is = typeof document === 'undefined' ? {node: true} : {browser: true};

} else {
cwd = (typeof location === 'undefined'
? window.location
: location
cwd = (
typeof location === 'undefined' ? window.location : location
).href.replace(/\/[^/]*$/, '/');

@@ -485,6 +483,6 @@ slash = '/';

return function(stack) {
return function (stack) {
stack = stack.split('\n');
stack = stack.reduce(function(list, line) {
stack = stack.reduce(function (list, line) {
if (isMochaInternal(line)) {

@@ -537,44 +535,6 @@ return list;

/**
* Single quote text by combining with undirectional ASCII quotation marks.
*
* @description
* Provides a simple means of markup for quoting text to be used in output.
* Use this to quote names of variables, methods, and packages.
*
* <samp>package 'foo' cannot be found</samp>
*
* @private
* @param {string} str - Value to be quoted.
* @returns {string} quoted value
* @example
* sQuote('n') // => 'n'
*/
exports.sQuote = function(str) {
return "'" + str + "'";
};
/**
* Double quote text by combining with undirectional ASCII quotation marks.
*
* @description
* Provides a simple means of markup for quoting text to be used in output.
* Use this to quote names of datatypes, classes, pathnames, and strings.
*
* <samp>argument 'value' must be "string" or "number"</samp>
*
* @private
* @param {string} str - Value to be quoted.
* @returns {string} quoted value
* @example
* dQuote('number') // => "number"
*/
exports.dQuote = function(str) {
return '"' + str + '"';
};
/**
* It's a noop.
* @public
*/
exports.noop = function() {};
exports.noop = function () {};

@@ -596,3 +556,3 @@ /**

*/
exports.createMap = function(obj) {
exports.createMap = function (obj) {
return Object.assign.apply(

@@ -616,3 +576,3 @@ null,

*/
exports.defineConstants = function(obj) {
exports.defineConstants = function (obj) {
if (canonicalType(obj) !== 'object' || !Object.keys(obj).length) {

@@ -625,28 +585,2 @@ throw new TypeError('Invalid argument; expected a non-empty object');

/**
* Whether current version of Node support ES modules
*
* @description
* Versions prior to 10 did not support ES Modules, and version 10 has an old incompatible version of ESM.
* This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs,
* which is version >=12.11.
*
* @param {partialSupport} whether the full Node.js ESM support is available (>= 12) or just something that supports the runtime (>= 10)
*
* @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha
*/
exports.supportsEsModules = function(partialSupport) {
if (!exports.isBrowser() && process.versions && process.versions.node) {
var versionFields = process.versions.node.split('.');
var major = +versionFields[0];
var minor = +versionFields[1];
if (!partialSupport) {
return major >= 13 || (major === 12 && minor >= 11);
} else {
return major >= 10;
}
}
};
/**
* Returns current working directory

@@ -671,31 +605,2 @@ *

/**
* 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 errors.createUnsupportedError(
'lookupFiles() is only supported in Node.js!'
);
}
errors.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);
};
/*

@@ -702,0 +607,0 @@ * Casts `value` to an array; useful for optionally accepting array parameters

{
"name": "mocha",
"version": "8.3.2",
"version": "10.2.0",
"type": "commonjs",
"description": "simple, flexible, fun test framework",

@@ -20,6 +21,2 @@ "keywords": [

],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mochajs"
},
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -34,2 +31,7 @@ "license": "MIT",

},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mochajs"
},
"gitter": "https://gitter.im/mochajs/mocha",
"homepage": "https://mochajs.org/",

@@ -39,3 +41,3 @@ "logo": "https://cldup.com/S9uQ-cOLYz.svg",

"bin": {
"mocha": "./bin/mocha",
"mocha": "./bin/mocha.js",
"_mocha": "./bin/_mocha"

@@ -48,3 +50,3 @@ },

"engines": {
"node": ">= 10.12.0"
"node": ">= 14.0.0"
},

@@ -59,24 +61,20 @@ "scripts": {

"dependencies": {
"@ungap/promise-all-settled": "1.1.2",
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.1",
"debug": "4.3.1",
"chokidar": "3.5.3",
"debug": "4.3.4",
"diff": "5.0.0",
"escape-string-regexp": "4.0.0",
"find-up": "5.0.0",
"glob": "7.1.6",
"growl": "1.10.5",
"glob": "7.2.0",
"he": "1.2.0",
"js-yaml": "4.0.0",
"log-symbols": "4.0.0",
"minimatch": "3.0.4",
"js-yaml": "4.1.0",
"log-symbols": "4.1.0",
"minimatch": "5.0.1",
"ms": "2.1.3",
"nanoid": "3.1.20",
"serialize-javascript": "5.0.1",
"nanoid": "3.3.3",
"serialize-javascript": "6.0.0",
"strip-json-comments": "3.1.1",
"supports-color": "8.1.1",
"which": "2.0.2",
"wide-align": "1.1.3",
"workerpool": "6.1.0",
"workerpool": "6.2.1",
"yargs": "16.2.0",

@@ -87,51 +85,44 @@ "yargs-parser": "20.2.4",

"devDependencies": {
"@11ty/eleventy": "^0.11.0",
"@11ty/eleventy-plugin-inclusive-language": "^1.0.0",
"@babel/preset-env": "^7.12.17",
"@mocha/docdash": "^3.0.1",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@11ty/eleventy": "^1.0.0",
"@11ty/eleventy-plugin-inclusive-language": "^1.0.3",
"@babel/eslint-parser": "^7.19.1",
"@mocha/docdash": "^4.0.1",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-multi-entry": "^3.0.1",
"@rollup/plugin-node-resolve": "^8.4.0",
"assetgraph-builder": "^8.1.0",
"@rollup/plugin-multi-entry": "^4.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",
"assetgraph-builder": "^9.0.0",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"canvas": "^2.6.1",
"chai": "^4.2.0",
"coffee-script": "^1.12.7",
"configstore": "^5.0.1",
"core-js": "^3.6.5",
"coveralls": "^3.1.0",
"canvas": "^2.9.0",
"chai": "^4.3.4",
"coffeescript": "^2.6.1",
"coveralls": "^3.1.1",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.3",
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-config-semistandard": "^15.0.1",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-semistandard": "^17.0.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"fail-on-errors-webpack-plugin": "^3.0.0",
"fs-extra": "^9.0.1",
"fs-extra": "^10.0.0",
"husky": "^4.2.5",
"hyperlink": "^4.5.2",
"jsdoc": "^3.6.5",
"jsdoc-ts-utils": "^1.1.2",
"karma": "^5.1.1",
"hyperlink": "^5.0.4",
"jsdoc": "^3.6.7",
"jsdoc-ts-utils": "^2.0.1",
"karma": "^6.3.11",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-requirejs": "^1.1.0",
"karma-sauce-launcher": "^4.3.4",
"karma-sauce-launcher": "^4.3.6",
"lint-staged": "^10.2.11",
"markdown-it": "^11.0.0",
"markdown-it-anchor": "^5.3.0",
"markdown-it-attrs": "^3.0.3",
"markdown-it-emoji": "^1.4.0",
"markdown-it-prism": "^2.1.1",
"markdown-it": "^12.3.2",
"markdown-it-anchor": "^8.4.1",
"markdown-it-attrs": "^4.1.3",
"markdown-it-emoji": "^2.0.0",
"markdown-it-prism": "^2.2.2",
"markdown-toc": "^1.2.0",
"markdownlint-cli": "^0.23.2",
"markdownlint-cli": "^0.30.0",
"needle": "^2.5.0",

@@ -141,18 +132,15 @@ "nps": "^5.10.0",

"pidtree": "^0.5.0",
"prettier": "^1.19.1",
"remark": "^12.0.1",
"remark-github": "^9.0.1",
"remark-inline-links": "^4.0.0",
"requirejs": "^2.3.6",
"prettier": "^2.4.1",
"remark": "^14.0.2",
"remark-github": "^11.2.2",
"remark-inline-links": "^6.0.1",
"rewiremock": "^3.14.3",
"rimraf": "^3.0.2",
"rollup": "^2.23.1",
"rollup": "^2.70.1",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-visualizer": "^4.1.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-visualizer": "^5.6.0",
"sinon": "^9.0.3",
"strip-ansi": "^6.0.0",
"svgo": "^1.3.2",
"through2": "^4.0.2",
"to-vfile": "^6.1.0",
"touch": "^3.1.0",

@@ -167,9 +155,7 @@ "unexpected": "^11.14.0",

"uuid": "^8.3.0",
"watchify": "^3.11.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
"webpack": "^5.67.0",
"webpack-cli": "^4.9.1"
},
"files": [
"bin/*mocha",
"assets/growl/*.png",
"bin/*mocha*",
"lib/**/*.{js,html,json}",

@@ -184,21 +170,21 @@ "index.js",

"./index.js": "./browser-entry.js",
"./lib/nodejs/growl.js": "./lib/browser/growl.js",
"./lib/esm-utils.js": false,
"fs": false,
"path": false,
"supports-color": false,
"./lib/nodejs/buffered-worker-pool.js": false,
"./lib/nodejs/esm-utils.js": false,
"./lib/nodejs/file-unloader.js": false,
"./lib/nodejs/parallel-buffered-runner.js": false,
"./lib/nodejs/serializer.js": false,
"./lib/nodejs/worker.js": false,
"./lib/nodejs/buffered-worker-pool.js": false,
"./lib/nodejs/parallel-buffered-runner.js": false,
"./lib/nodejs/reporters/parallel-buffered.js": false,
"./lib/nodejs/file-unloader.js": false,
"./lib/cli/index.js": false
},
"prettier": {
"arrowParens": "avoid",
"bracketSpacing": false,
"endOfLine": "auto",
"singleQuote": true,
"bracketSpacing": false,
"endOfLine": "auto"
"trailingComma": "none"
},
"gitter": "https://gitter.im/mochajs/mocha",
"husky": {

@@ -205,0 +191,0 @@ "hooks": {

@@ -12,4 +12,4 @@ <p align="center">

<a href="https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter"></a>
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/backers/badge.svg" alt="OpenCollective"></a>
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/sponsors/badge.svg" alt="OpenCollective"></a>
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective"></a>
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective"></a>
</p>

@@ -31,3 +31,2 @@

- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
- [Google Group](https://groups.google.com/group/mochajs)
- [Issue Tracker](https://github.com/mochajs/mocha/issues)

@@ -37,59 +36,14 @@

[Become a backer](https://opencollective.com/mochajs#backer) and show your support to our open source project.
[Become a backer](https://opencollective.com/mochajs) and show your support to our open source project on [our site](https://mochajs.org/#backers).
[![MochaJS Backer](https://opencollective.com/mochajs/backer/0/avatar)](https://opencollective.com/mochajs/backer/0/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/1/avatar)](https://opencollective.com/mochajs/backer/1/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/2/avatar)](https://opencollective.com/mochajs/backer/2/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/3/avatar)](https://opencollective.com/mochajs/backer/3/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/4/avatar)](https://opencollective.com/mochajs/backer/4/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/5/avatar)](https://opencollective.com/mochajs/backer/5/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/6/avatar)](https://opencollective.com/mochajs/backer/6/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/7/avatar)](https://opencollective.com/mochajs/backer/7/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/8/avatar)](https://opencollective.com/mochajs/backer/8/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/9/avatar)](https://opencollective.com/mochajs/backer/9/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/10/avatar)](https://opencollective.com/mochajs/backer/10/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/11/avatar)](https://opencollective.com/mochajs/backer/11/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/12/avatar)](https://opencollective.com/mochajs/backer/12/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/13/avatar)](https://opencollective.com/mochajs/backer/13/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/14/avatar)](https://opencollective.com/mochajs/backer/14/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/15/avatar)](https://opencollective.com/mochajs/backer/15/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/16/avatar)](https://opencollective.com/mochajs/backer/16/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/17/avatar)](https://opencollective.com/mochajs/backer/17/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/18/avatar)](https://opencollective.com/mochajs/backer/18/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/19/avatar)](https://opencollective.com/mochajs/backer/19/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/20/avatar)](https://opencollective.com/mochajs/backer/20/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/21/avatar)](https://opencollective.com/mochajs/backer/21/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/22/avatar)](https://opencollective.com/mochajs/backer/22/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/23/avatar)](https://opencollective.com/mochajs/backer/23/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/24/avatar)](https://opencollective.com/mochajs/backer/24/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/25/avatar)](https://opencollective.com/mochajs/backer/25/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/26/avatar)](https://opencollective.com/mochajs/backer/26/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/27/avatar)](https://opencollective.com/mochajs/backer/27/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/28/avatar)](https://opencollective.com/mochajs/backer/28/website)
[![MochaJS Backer](https://opencollective.com/mochajs/backer/29/avatar)](https://opencollective.com/mochajs/backer/29/website)
<a href="https://opencollective.com/mochajs"><img src="https://opencollective.com/mochajs/tiers/backers.svg?limit=30&button=false&avatarHeight=46&width=750"></a>
## Sponsors
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor).
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org#sponsors) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs).
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/0/avatar)](https://opencollective.com/mochajs/sponsor/0/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/1/avatar)](https://opencollective.com/mochajs/sponsor/1/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/2/avatar)](https://opencollective.com/mochajs/sponsor/2/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/3/avatar)](https://opencollective.com/mochajs/sponsor/3/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/4/avatar)](https://opencollective.com/mochajs/sponsor/4/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/5/avatar)](https://opencollective.com/mochajs/sponsor/5/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/6/avatar)](https://opencollective.com/mochajs/sponsor/6/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/7/avatar)](https://opencollective.com/mochajs/sponsor/7/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/8/avatar)](https://opencollective.com/mochajs/sponsor/8/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/9/avatar)](https://opencollective.com/mochajs/sponsor/9/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/10/avatar)](https://opencollective.com/mochajs/sponsor/10/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/11/avatar)](https://opencollective.com/mochajs/sponsor/11/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/12/avatar)](https://opencollective.com/mochajs/sponsor/12/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/13/avatar)](https://opencollective.com/mochajs/sponsor/13/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/14/avatar)](https://opencollective.com/mochajs/sponsor/14/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/15/avatar)](https://opencollective.com/mochajs/sponsor/15/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/16/avatar)](https://opencollective.com/mochajs/sponsor/16/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/17/avatar)](https://opencollective.com/mochajs/sponsor/17/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/18/avatar)](https://opencollective.com/mochajs/sponsor/18/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/19/avatar)](https://opencollective.com/mochajs/sponsor/19/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/0/avatar)](https://opencollective.com/mochajs/tiers/sponsors/0/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/1/avatar)](https://opencollective.com/mochajs/tiers/sponsors/1/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/2/avatar)](https://opencollective.com/mochajs/tiers/sponsors/2/website)
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/3/avatar)](https://opencollective.com/mochajs/tiers/sponsors/3/website)

@@ -100,3 +54,3 @@ ## Development

- Mocha is the _most-depended-upon_ module on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
- Mocha is one of the _most-depended-upon_ modules on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
- Mocha is an _independent_ open-source project, maintained exclusively by volunteers.

@@ -118,4 +72,4 @@

Copyright 2011-2021 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE).
Copyright 2011-2022 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE).
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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