Socket
Socket
Sign inDemoInstall

mocha

Package Overview
Dependencies
Maintainers
2
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 5.2.0 to 6.0.0-0

assets/growl/error.png

51

bin/options.js
'use strict';
/**
* Dependencies.
/*
* This module is deprecated and will be removed in a future version of Mocha.
* @deprecated Deprecated in v6.0.0; source moved into {@link module:lib/cli/options lib/cli/options module}.
* @module
* @exports module:lib/cli/options
*/
const fs = require('fs');
/**
* Export `getOptions`.
*/
module.exports = getOptions;
/**
* Get options.
*/
function getOptions() {
if (
process.argv.length === 3 &&
(process.argv[2] === '-h' || process.argv[2] === '--help')
) {
return;
}
const optsPath =
process.argv.indexOf('--opts') === -1
? 'test/mocha.opts'
: process.argv[process.argv.indexOf('--opts') + 1];
try {
const opts = fs
.readFileSync(optsPath, 'utf8')
.replace(/^#.*$/gm, '')
.replace(/\\\s/g, '%20')
.split(/\s/)
.filter(Boolean)
.map(value => value.replace(/%20/g, ' '));
process.argv = process.argv
.slice(0, 2)
.concat(opts.concat(process.argv.slice(2)));
} catch (ignore) {
// NOTE: should console.error() and throw the error
}
process.env.LOADED_MOCHA_OPTS = true;
}
module.exports = require('../lib/cli/options');

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

process.stdout = require('browser-stdout')({level: false});
process.stdout = require('browser-stdout')({label: false});

@@ -13,0 +13,0 @@ var Mocha = require('./lib/mocha');

'use strict';
// just stub out growl
/**
* Web Notifications module.
* @module Growl
*/
module.exports = require('../utils').noop;
/**
* Save timer references to avoid Sinon interfering (see GH-237).
*/
var Date = global.Date;
var setTimeout = global.setTimeout;
/**
* Checks if browser notification support exists.
*
* @public
* @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
* @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
* @see {@link Mocha#growl}
* @see {@link Mocha#isGrowlCapable}
* @return {boolean} whether browser notification support exists
*/
exports.isCapable = function() {
var hasNotificationSupport = 'Notification' in window;
var hasPromiseSupport = typeof Promise === 'function';
return process.browser && hasNotificationSupport && hasPromiseSupport;
};
/**
* Implements browser notifications as a pseudo-reporter.
*
* @public
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
* @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
* @see {@link Growl#isPermitted}
* @see {@link Mocha#_growl}
* @param {Runner} runner - Runner instance.
*/
exports.notify = function(runner) {
var promise = isPermitted();
/**
* Attempt notification.
*/
var sendNotification = function() {
// If user hasn't responded yet... "No notification for you!" (Seinfeld)
Promise.race([promise, Promise.resolve(undefined)])
.then(canNotify)
.then(function() {
display(runner);
})
.catch(notPermitted);
};
runner.once('end', sendNotification);
};
/**
* Checks if browser notification is permitted by user.
*
* @private
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
* @see {@link Mocha#growl}
* @see {@link Mocha#isGrowlPermitted}
* @returns {Promise<boolean>} promise determining if browser notification
* permissible when fulfilled.
*/
function isPermitted() {
var permitted = {
granted: function allow() {
return Promise.resolve(true);
},
denied: function deny() {
return Promise.resolve(false);
},
default: function ask() {
return Notification.requestPermission().then(function(permission) {
return permission === 'granted';
});
}
};
return permitted[Notification.permission]();
}
/**
* @summary
* Determines if notification should proceed.
*
* @description
* Notification shall <strong>not</strong> proceed unless `value` is true.
*
* `value` will equal one of:
* <ul>
* <li><code>true</code> (from `isPermitted`)</li>
* <li><code>false</code> (from `isPermitted`)</li>
* <li><code>undefined</code> (from `Promise.race`)</li>
* </ul>
*
* @private
* @param {boolean|undefined} value - Determines if notification permissible.
* @returns {Promise<undefined>} Notification can proceed
*/
function canNotify(value) {
if (!value) {
var why = value === false ? 'blocked' : 'unacknowledged';
var reason = 'not permitted by user (' + why + ')';
return Promise.reject(new Error(reason));
}
return Promise.resolve();
}
/**
* Displays the notification.
*
* @private
* @param {Runner} runner - Runner instance.
*/
function display(runner) {
var stats = runner.stats;
var symbol = {
cross: '\u274C',
tick: '\u2705'
};
var logo = require('../../package').notifyLogo;
var _message;
var message;
var title;
if (stats.failures) {
_message = stats.failures + ' of ' + runner.total + ' tests failed';
message = symbol.cross + ' ' + _message;
title = 'Failed';
} else {
_message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
message = symbol.tick + ' ' + _message;
title = 'Passed';
}
// Send notification
var options = {
badge: logo,
body: message,
dir: 'ltr',
icon: logo,
lang: 'en-US',
name: 'mocha',
requireInteraction: false,
timestamp: Date.now()
};
var notification = new Notification(title, options);
// Autoclose after brief delay (makes various browsers act same)
var FORCE_DURATION = 4000;
setTimeout(notification.close.bind(notification), FORCE_DURATION);
}
/**
* As notifications are tangential to our purpose, just log the error.
*
* @private
* @param {Error} err - Why notification didn't happen.
*/
function notPermitted(err) {
console.error('notification error:', err.message);
}

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

*
* @api public
* @public
* @param {number} size

@@ -35,3 +35,3 @@ * @return {Progress} Progress instance.

*
* @api public
* @public
* @param {string} text

@@ -48,3 +48,3 @@ * @return {Progress} Progress instance.

*
* @api public
* @public
* @param {number} size

@@ -51,0 +51,0 @@ * @return {Progress} Progress instance.

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

*
* @api private
* @private
*/

@@ -22,3 +22,3 @@ function Context() {}

*
* @api private
* @private
* @param {Runnable} runnable

@@ -38,3 +38,3 @@ * @return {Context} context

*
* @api private
* @private
* @param {number} ms

@@ -54,3 +54,3 @@ * @return {Context} self

*
* @api private
* @private
* @param {boolean} enabled

@@ -70,3 +70,3 @@ * @return {Context} self

*
* @api private
* @private
* @param {number} ms

@@ -86,3 +86,3 @@ * @return {Context} self

*
* @api private
* @private
* @throws Pending

@@ -97,3 +97,3 @@ */

*
* @api private
* @private
* @param {number} n

@@ -100,0 +100,0 @@ * @return {Context} self

@@ -115,1 +115,3 @@ 'use strict';

};
module.exports.description = 'BDD or RSpec style [default]';
'use strict';
var Suite = require('../suite');
var utils = require('../utils');
var errors = require('../errors');
var createMissingArgumentError = errors.createMissingArgumentError;

@@ -14,2 +17,18 @@ /**

module.exports = function(suites, context, mocha) {
/**
* Check if the suite should be tested.
*
* @private
* @param {Suite} suite - suite to check
* @returns {boolean}
*/
function shouldBeTested(suite) {
return (
!mocha.options.grep ||
(mocha.options.grep &&
mocha.options.grep.test(suite.fullTitle()) &&
!mocha.options.invert)
);
}
return {

@@ -96,2 +115,3 @@ /**

* Creates a suite.
*
* @param {Object} opts Options

@@ -111,12 +131,32 @@ * @param {string} opts.title Title of Suite

if (opts.isOnly) {
if (mocha.options.forbidOnly && shouldBeTested(suite)) {
throw new Error('`.only` forbidden');
}
suite.parent._onlySuites = suite.parent._onlySuites.concat(suite);
}
if (suite.pending) {
if (mocha.options.forbidPending && shouldBeTested(suite)) {
throw new Error('Pending test forbidden');
}
}
if (typeof opts.fn === 'function') {
opts.fn.call(suite);
var result = opts.fn.call(suite);
if (typeof result !== 'undefined') {
utils.deprecate(
'Deprecation Warning: Suites do not support a return value;' +
opts.title +
' returned :' +
result
);
}
suites.shift();
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
throw new Error(
throw createMissingArgumentError(
'Suite "' +
suite.fullTitle() +
'" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.'
'" was defined but no callback was supplied. ' +
'Supply a callback or explicitly skip the suite.',
'callback',
'function'
);

@@ -123,0 +163,0 @@ } else if (!opts.fn && suite.pending) {

@@ -59,1 +59,3 @@ 'use strict';

};
module.exports.description = 'Node.js module ("exports") style';

@@ -96,1 +96,3 @@ 'use strict';

};
module.exports.description = 'QUnit style';

@@ -103,1 +103,4 @@ 'use strict';

};
module.exports.description =
'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';

@@ -11,4 +11,10 @@ 'use strict';

var path = require('path');
var reporters = require('./reporters');
var builtinReporters = require('./reporters');
var growl = require('./growl');
var utils = require('./utils');
var mocharc = require('./mocharc.json');
var assign = require('object.assign').getPolyfill();
var errors = require('./errors');
var createInvalidReporterError = errors.createInvalidReporterError;
var createInvalidInterfaceError = errors.createInvalidInterfaceError;

@@ -38,7 +44,6 @@ exports = module.exports = Mocha;

/**
*
* @public
* @memberof Mocha
* @public
*/
exports.reporters = reporters;
exports.reporters = builtinReporters;
exports.Runnable = require('./runnable');

@@ -56,66 +61,101 @@ exports.Context = require('./context');

/**
* Return image `name` path.
* Constructs a new Mocha instance with `options`.
*
* @private
* @param {string} name
* @return {string}
*/
function image(name) {
return path.join(__dirname, '..', 'assets', 'growl', name + '.png');
}
/**
* Set up mocha with `options`.
*
* Options:
*
* - `ui` name "bdd", "tdd", "exports" etc
* - `reporter` reporter instance, defaults to `mocha.reporters.spec`
* - `globals` array of accepted globals
* - `timeout` timeout in milliseconds
* - `retries` number of times to retry failed tests
* - `bail` bail on the first test failure
* - `slow` milliseconds to wait before considering a test slow
* - `ignoreLeaks` ignore global leaks
* - `fullTrace` display the full stack-trace on failing
* - `grep` string or regexp to filter tests with
*
* @public
* @class Mocha
* @param {Object} options
* @param {Object} [options] - Settings object.
* @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
* @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
* @param {boolean} [options.bail] - Bail after first test failure?
* @param {boolean} [options.checkLeaks] - If true, check leaks.
* @param {boolean} [options.delay] - Delay root suite execution?
* @param {boolean} [options.enableTimeouts] - Enable timeouts?
* @param {string} [options.fgrep] - Test filter given string.
* @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
* @param {boolean} [options.forbidPending] - Pending tests fail the suite?
* @param {boolean} [options.fullStackTrace] - Full stacktrace upon failure?
* @param {string[]} [options.global] - Variables expected in global scope.
* @param {RegExp|string} [options.grep] - Test filter given regular expression.
* @param {boolean} [options.growl] - Enable desktop notifications?
* @param {boolean} [options.hideDiff] - Suppress diffs from failures?
* @param {boolean} [options.ignoreLeaks] - Ignore global leaks?
* @param {boolean} [options.invert] - Invert test filter matches?
* @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
* @param {string} [options.reporter] - Reporter name.
* @param {Object} [options.reporterOption] - Reporter settings object.
* @param {number} [options.retries] - Number of times to retry failed tests.
* @param {number} [options.slow] - Slow threshold value.
* @param {number|string} [options.timeout] - Timeout threshold value.
* @param {string} [options.ui] - Interface name.
* @param {boolean} [options.color] - Color TTY output from reporter?
* @param {boolean} [options.useInlineDiffs] - Use inline diffs?
*/
function Mocha(options) {
options = options || {};
options = assign({}, mocharc, options || {});
this.files = [];
this.options = options;
if (options.grep) {
this.grep(new RegExp(options.grep));
// root suite
this.suite = new exports.Suite('', new exports.Context());
if ('useColors' in options) {
utils.deprecate(
'useColors is DEPRECATED and will be removed from a future version of Mocha. Instead, use the "color" option'
);
options.color = 'color' in options ? options.color : options.useColors;
}
if (options.fgrep) {
this.fgrep(options.fgrep);
this.grep(options.grep)
.fgrep(options.fgrep)
.ui(options.ui)
.bail(options.bail)
.reporter(options.reporter, options.reporterOptions)
.useColors(options.color)
.slow(options.slow)
.useInlineDiffs(options.inlineDiffs)
.globals(options.globals);
if ('enableTimeouts' in options) {
utils.deprecate(
'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
);
}
this.suite = new exports.Suite('', new exports.Context());
this.ui(options.ui);
this.bail(options.bail);
this.reporter(options.reporter, options.reporterOptions);
if (typeof options.timeout !== 'undefined' && options.timeout !== null) {
this.timeout(options.timeout);
}
if (typeof options.retries !== 'undefined' && options.retries !== null) {
this.timeout(
options.enableTimeouts === false || options.timeout === false
? 0
: options.timeout
);
if ('retries' in options) {
this.retries(options.retries);
}
this.useColors(options.useColors);
if (options.enableTimeouts !== null) {
this.enableTimeouts(options.enableTimeouts);
if ('diff' in options) {
this.hideDiff(!options.diff);
}
if (options.slow) {
this.slow(options.slow);
}
[
'allowUncaught',
'asyncOnly',
'checkLeaks',
'delay',
'forbidOnly',
'forbidPending',
'fullTrace',
'growl',
'invert'
].forEach(function(opt) {
if (options[opt]) {
this[opt]();
}
}, this);
}
/**
* Enable or disable bailing on the first failure.
* Enables or disables bailing on the first failure.
*
* @public
* @api public
* @param {boolean} [bail]
* @see {@link https://mochajs.org/#-b---bail|CLI option}
* @param {boolean} [bail=true] - Whether to bail on first error.
* @returns {Mocha} this
* @chainable
*/

@@ -131,7 +171,13 @@ Mocha.prototype.bail = function(bail) {

/**
* Add test `file`.
* @summary
* Adds `file` to be loaded for execution.
*
* @description
* Useful for generic setup code that must be included within test suite.
*
* @public
* @api public
* @param {string} file
* @see {@link https://mochajs.org/#--file-file|CLI option}
* @param {string} file - Pathname of file to be loaded.
* @returns {Mocha} this
* @chainable
*/

@@ -144,10 +190,16 @@ Mocha.prototype.addFile = function(file) {

/**
* Set reporter to `reporter`, defaults to "spec".
* Sets reporter to `reporter`, defaults to "spec".
*
* @public
* @param {String|Function} reporter name or constructor
* @param {Object} reporterOptions optional options
* @api public
* @param {string|Function} reporter name or constructor
* @param {Object} reporterOptions optional options
* @see {@link https://mochajs.org/#-r---reporter-name|CLI option}
* @see {@link https://mochajs.org/#reporters|Reporters}
* @param {String|Function} reporter - Reporter name or constructor.
* @param {Object} [reporterOptions] - Options used to configure the reporter.
* @returns {Mocha} this
* @chainable
* @throws {Error} if requested reporter cannot be loaded
* @example
*
* // Use XUnit reporter and direct its output to file
* mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
*/

@@ -161,4 +213,4 @@ Mocha.prototype.reporter = function(reporter, reporterOptions) {

// Try to load a built-in reporter.
if (reporters[reporter]) {
_reporter = reporters[reporter];
if (builtinReporters[reporter]) {
_reporter = builtinReporters[reporter];
}

@@ -170,3 +222,6 @@ // Try to load reporters from process.cwd() and node_modules

} catch (err) {
if (err.message.indexOf('Cannot find module') !== -1) {
if (
err.code !== 'MODULE_NOT_FOUND' ||
err.message.indexOf('Cannot find module') !== -1
) {
// Try to load reporters from a path (absolute or relative)

@@ -176,3 +231,4 @@ try {

} catch (_err) {
err.message.indexOf('Cannot find module') !== -1
_err.code !== 'MODULE_NOT_FOUND' ||
_err.message.indexOf('Cannot find module') !== -1
? console.warn('"' + reporter + '" reporter not found')

@@ -201,3 +257,6 @@ : console.warn(

if (!_reporter) {
throw new Error('invalid reporter "' + reporter + '"');
throw createInvalidReporterError(
'invalid reporter "' + reporter + '"',
reporter
);
}

@@ -211,6 +270,11 @@ this._reporter = _reporter;

/**
* Set test UI `name`, defaults to "bdd".
* Sets test UI `name`, defaults to "bdd".
*
* @public
* @api public
* @param {string} bdd
* @see {@link https://mochajs.org/#-u---ui-name|CLI option}
* @see {@link https://mochajs.org/#interfaces|Interface DSLs}
* @param {string} [name=bdd] - Interface name.
* @returns {Mocha} this
* @chainable
* @throws {Error} if requested interface cannot be loaded
*/

@@ -224,3 +288,6 @@ Mocha.prototype.ui = function(name) {

} catch (err) {
throw new Error('invalid interface "' + name + '"');
throw createInvalidInterfaceError(
'invalid interface "' + name + '"',
name
);
}

@@ -237,3 +304,3 @@ }

exports.it = context.it || context.test;
exports.xit = context.xit || context.test.skip;
exports.xit = context.xit || (context.test && context.test.skip);
exports.setup = context.setup || context.beforeEach;

@@ -252,5 +319,12 @@ exports.suiteSetup = context.suiteSetup || context.before;

/**
* Load registered files.
* @summary
* Loads `files` prior to execution.
*
* @api private
* @description
* The implementation relies on Node's `require` to execute
* the test interface functions and will be subject to its cache.
*
* @private
* @see {@link Mocha#addFile}
* @param {Function} [fn] - Callback invoked upon completion.
*/

@@ -270,33 +344,18 @@ Mocha.prototype.loadFiles = function(fn) {

/**
* Enable growl support.
* Sets `grep` filter after escaping RegExp special characters.
*
* @api private
*/
Mocha.prototype._growl = function(runner, reporter) {
var notify = require('growl');
runner.on('end', function() {
var stats = reporter.stats;
if (stats.failures) {
var msg = stats.failures + ' of ' + runner.total + ' tests failed';
notify(msg, {name: 'mocha', title: 'Failed', image: image('error')});
} else {
notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
name: 'mocha',
title: 'Passed',
image: image('ok')
});
}
});
};
/**
* Escape string and add it to grep as a regexp.
* @public
* @see {@link Mocha#grep}
* @param {string} str - Value to be converted to a regexp.
* @returns {Mocha} this
* @chainable
* @example
*
* @public
* @api public
* @param str
* @returns {Mocha}
* // Select tests whose full title begins with `"foo"` followed by a period
* mocha.fgrep('foo.');
*/
Mocha.prototype.fgrep = function(str) {
if (!str) {
return this;
}
return this.grep(new RegExp(escapeRe(str)));

@@ -306,10 +365,34 @@ };

/**
* Add regexp to grep, if `re` is a string it is escaped.
* @summary
* Sets `grep` filter used to select specific tests for execution.
*
* @description
* If `re` is a regexp-like string, it will be converted to regexp.
* The regexp is tested against the full title of each test (i.e., the
* name of the test preceded by titles of each its ancestral suites).
* As such, using an <em>exact-match</em> fixed pattern against the
* test name itself will not yield any matches.
* <br>
* <strong>Previous filter value will be overwritten on each call!</strong>
*
* @public
* @param {RegExp|String} re
* @return {Mocha}
* @api public
* @param {RegExp|string} re
* @return {Mocha}
* @see {@link https://mochajs.org/#-g---grep-pattern|CLI option}
* @see {@link Mocha#fgrep}
* @see {@link Mocha#invert}
* @param {RegExp|String} re - Regular expression used to select tests.
* @return {Mocha} this
* @chainable
* @example
*
* // Select tests whose full title contains `"match"`, ignoring case
* mocha.grep(/match/i);
* @example
*
* // Same as above but with regexp-like string argument
* mocha.grep('/match/i');
* @example
*
* // ## Anti-example
* // Given embedded test `it('only-this-test')`...
* mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
*/

@@ -326,8 +409,14 @@ Mocha.prototype.grep = function(re) {

};
/**
* Invert `.grep()` matches.
* Inverts `grep` matches.
*
* @public
* @return {Mocha}
* @api public
* @see {@link Mocha#grep}
* @return {Mocha} this
* @chainable
* @example
*
* // Select tests whose full title does *not* contain `"match"`, ignoring case
* mocha.grep(/match/i).invert();
*/

@@ -340,13 +429,16 @@ Mocha.prototype.invert = function() {

/**
* Ignore global leaks.
* Enables or disables ignoring global leaks.
*
* @public
* @param {Boolean} ignore
* @return {Mocha}
* @api public
* @param {boolean} ignore
* @return {Mocha}
* @see {@link Mocha#checkLeaks}
* @param {boolean} ignoreLeaks - Whether to ignore global leaks.
* @return {Mocha} this
* @chainable
* @example
*
* // Ignore global leaks
* mocha.ignoreLeaks(true);
*/
Mocha.prototype.ignoreLeaks = function(ignore) {
this.options.ignoreLeaks = Boolean(ignore);
Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
this.options.ignoreLeaks = Boolean(ignoreLeaks);
return this;

@@ -356,7 +448,9 @@ };

/**
* Enable global leak checking.
* Enables checking for global variables leaked while running tests.
*
* @return {Mocha}
* @api public
* @public
* @see {@link https://mochajs.org/#--check-leaks|CLI option}
* @see {@link Mocha#ignoreLeaks}
* @return {Mocha} this
* @chainable
*/

@@ -369,7 +463,7 @@ Mocha.prototype.checkLeaks = function() {

/**
* Display long stack-trace on failing
* Displays full stack trace upon test failure.
*
* @return {Mocha}
* @api public
* @public
* @return {Mocha} this
* @chainable
*/

@@ -382,10 +476,18 @@ Mocha.prototype.fullTrace = function() {

/**
* Enable growl support.
* Enables desktop notification support if prerequisite software installed.
*
* @return {Mocha}
* @api public
* @public
* @see {@link Mocha#isGrowlCapable}
* @see {@link Mocha#_growl}
* @return {Mocha} this
* @chainable
*/
Mocha.prototype.growl = function() {
this.options.growl = true;
this.options.growl = this.isGrowlCapable();
if (!this.options.growl) {
var detail = process.browser
? 'notification support not available in this browser...'
: 'notification support prerequisites not installed...';
console.error(detail + ' cannot enable!');
}
return this;

@@ -395,10 +497,38 @@ };

/**
* Ignore `globals` array or string.
* @summary
* Determines if Growl support seems likely.
*
* @param {Array|String} globals
* @return {Mocha}
* @api public
* @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.
*
* @public
* @param {Array|string} globals
* @return {Mocha}
* @see {@link https://mochajs.org/#--globals-names|CLI option}
* @see {@link Mocha#checkLeaks}
* @param {String[]|String} globals - Accepted global variable name(s).
* @return {Mocha} this
* @chainable
* @example
*
* // Specify variables to be expected in global scope
* mocha.globals(['jQuery', 'MyLib']);
*/

@@ -411,10 +541,8 @@ Mocha.prototype.globals = function(globals) {

/**
* Emit color output.
* Enables or disables TTY color output by screen-oriented reporters.
*
* @param {Boolean} colors
* @return {Mocha}
* @api public
* @public
* @param {boolean} colors
* @return {Mocha}
* @param {boolean} colors - Whether to enable color output.
* @return {Mocha} this
* @chainable
*/

@@ -429,10 +557,9 @@ Mocha.prototype.useColors = function(colors) {

/**
* Use inline diffs rather than +/-.
* Determines if reporter should use inline diffs (rather than +/-)
* in test failure output.
*
* @param {Boolean} inlineDiffs
* @return {Mocha}
* @api public
* @public
* @param {boolean} inlineDiffs
* @return {Mocha}
* @param {boolean} inlineDiffs - Whether to use inline diffs.
* @return {Mocha} this
* @chainable
*/

@@ -445,10 +572,8 @@ Mocha.prototype.useInlineDiffs = function(inlineDiffs) {

/**
* Do not show diffs at all.
* Determines if reporter should include diffs in test failure output.
*
* @param {Boolean} hideDiff
* @return {Mocha}
* @api public
* @public
* @param {boolean} hideDiff
* @return {Mocha}
* @param {boolean} hideDiff - Whether to hide diffs.
* @return {Mocha} this
* @chainable
*/

@@ -461,13 +586,28 @@ Mocha.prototype.hideDiff = function(hideDiff) {

/**
* Set the timeout in milliseconds.
* @summary
* Sets timeout threshold value.
*
* @param {Number} timeout
* @return {Mocha}
* @api public
* @description
* A string argument can use shorthand (such as "2s") and will be converted.
* If the value is `0`, timeouts will be disabled.
*
* @public
* @param {number} timeout
* @return {Mocha}
* @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
* @see {@link https://mochajs.org/#--no-timeouts|CLI option}
* @see {@link https://mochajs.org/#timeouts|Timeouts}
* @see {@link Mocha#enableTimeouts}
* @param {number|string} msecs - Timeout threshold value.
* @return {Mocha} this
* @chainable
* @example
*
* // Sets timeout to one second
* mocha.timeout(1000);
* @example
*
* // Same as above but using string argument
* mocha.timeout('1s');
*/
Mocha.prototype.timeout = function(timeout) {
this.suite.timeout(timeout);
Mocha.prototype.timeout = function(msecs) {
this.suite.timeout(msecs);
return this;

@@ -477,8 +617,13 @@ };

/**
* Set the number of times to retry failed tests.
* Sets the number of times to retry failed tests.
*
* @param {Number} retry times
* @return {Mocha}
* @api public
* @public
* @see {@link https://mochajs.org/#retry-tests|Retry Tests}
* @param {number} retry - Number of times to retry failed tests.
* @return {Mocha} this
* @chainable
* @example
*
* // Allow any failed test to retry one more time
* mocha.retries(1);
*/

@@ -491,13 +636,20 @@ Mocha.prototype.retries = function(n) {

/**
* Set slowness threshold in milliseconds.
* Sets slowness threshold value.
*
* @param {Number} slow
* @return {Mocha}
* @api public
* @public
* @param {number} slow
* @return {Mocha}
* @see {@link https://mochajs.org/#-s---slow-ms|CLI option}
* @param {number} msecs - Slowness threshold value.
* @return {Mocha} this
* @chainable
* @example
*
* // Sets "slow" threshold to half a second
* mocha.slow(500);
* @example
*
* // Same as above but using string argument
* mocha.slow('0.5s');
*/
Mocha.prototype.slow = function(slow) {
this.suite.slow(slow);
Mocha.prototype.slow = function(msecs) {
this.suite.slow(msecs);
return this;

@@ -507,14 +659,14 @@ };

/**
* Enable timeouts.
* Enables or disables timeouts.
*
* @param {Boolean} enabled
* @return {Mocha}
* @api public
* @public
* @param {boolean} enabled
* @return {Mocha}
* @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
* @see {@link https://mochajs.org/#--no-timeouts|CLI option}
* @param {boolean} enableTimeouts - Whether to enable timeouts.
* @return {Mocha} this
* @chainable
*/
Mocha.prototype.enableTimeouts = function(enabled) {
Mocha.prototype.enableTimeouts = function(enableTimeouts) {
this.suite.enableTimeouts(
arguments.length && enabled !== undefined ? enabled : true
arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
);

@@ -525,7 +677,7 @@ return this;

/**
* Makes all tests async (accepting a callback)
* Forces all tests to either accept a `done` callback or return a promise.
*
* @return {Mocha}
* @api public
* @public
* @return {Mocha} this
* @chainable
*/

@@ -538,6 +690,7 @@ Mocha.prototype.asyncOnly = function() {

/**
* Disable syntax highlighting (in browser).
* Disables syntax highlighting (in browser).
*
* @api public
* @public
* @return {Mocha} this
* @chainable
*/

@@ -550,7 +703,7 @@ Mocha.prototype.noHighlighting = function() {

/**
* Enable uncaught errors to propagate (in browser).
* Enables uncaught errors to propagate (in browser).
*
* @return {Mocha}
* @api public
* @public
* @return {Mocha} this
* @chainable
*/

@@ -563,4 +716,12 @@ Mocha.prototype.allowUncaught = function() {

/**
* Delay root suite execution.
* @returns {Mocha}
* @summary
* Delays root suite execution.
*
* @description
* Used to perform asynch operations before any suites are run.
*
* @public
* @see {@link https://mochajs.org/#delayed-root-suite|delayed root suite}
* @returns {Mocha} this
* @chainable
*/

@@ -573,4 +734,7 @@ Mocha.prototype.delay = function delay() {

/**
* Tests marked only fail the suite
* @returns {Mocha}
* Causes tests marked `only` to fail the suite.
*
* @public
* @returns {Mocha} this
* @chainable
*/

@@ -583,4 +747,7 @@ Mocha.prototype.forbidOnly = function() {

/**
* Pending tests and tests marked skip fail the suite
* @returns {Mocha}
* Causes pending tests and tests marked `skip` to fail the suite.
*
* @public
* @returns {Mocha} this
* @chainable
*/

@@ -593,16 +760,36 @@ Mocha.prototype.forbidPending = function() {

/**
* Run tests and invoke `fn()` when complete.
* Mocha version as specified by "package.json".
*
* Note that `loadFiles` relies on Node's `require` to execute
* the test interface functions and will be subject to the
* cache - if the files are already in the `require` cache,
* they will effectively be skipped. Therefore, to run tests
* multiple times or to run tests in files that are already
* in the `require` cache, make sure to clear them from the
* cache first in whichever manner best suits your needs.
* @name Mocha#version
* @type string
* @readonly
*/
Object.defineProperty(Mocha.prototype, 'version', {
value: require('../package.json').version,
configurable: false,
enumerable: true,
writable: false
});
/**
* Callback to be invoked when test execution is complete.
*
* @api public
* @callback DoneCB
* @param {number} failures - Number of failures that occurred.
*/
/**
* @summary
* Runs tests and invokes `fn()` when complete.
*
* @description
* To run tests multiple times (or to run tests in files that are
* already in the `require` cache), make sure to clear them from
* the cache first!
*
* @public
* @param {Function} fn
* @return {Runner}
* @see {@link Mocha#loadFiles}
* @see {@link Runner#run}
* @param {DoneCB} [fn] - Callback invoked when test execution completed.
* @return {Runner} runner instance
*/

@@ -631,3 +818,3 @@ Mocha.prototype.run = function(fn) {

if (options.growl) {
this._growl(runner, reporter);
this._growl(runner);
}

@@ -641,6 +828,7 @@ if (options.useColors !== undefined) {

function done(failures) {
fn = fn || function fn() {};
if (reporter.done) {
reporter.done(failures, fn);
} else {
fn && fn(failures);
fn(failures);
}

@@ -647,0 +835,0 @@ }

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

var diff = require('diff');
var ms = require('../ms');
var milliseconds = require('ms');
var utils = require('../utils');

@@ -23,15 +23,2 @@ var supportsColor = process.browser ? null : require('supports-color');

/**
* Save timer references to avoid Sinon interfering.
* See: https://github.com/mochajs/mocha/issues/237
*/
/* eslint-disable no-unused-vars, no-native-reassign */
var Date = global.Date;
var setTimeout = global.setTimeout;
var setInterval = global.setInterval;
var clearTimeout = global.clearTimeout;
var clearInterval = global.clearInterval;
/* eslint-enable no-unused-vars, no-native-reassign */
/**
* Check if both stdio streams are associated with a tty.

@@ -110,3 +97,3 @@ */

* @return {string}
* @api private
* @private
*/

@@ -204,3 +191,2 @@ var color = (exports.color = function(type, str) {

* @param {Array} failures
* @api public
*/

@@ -278,5 +264,3 @@

* All other reporters generally
* inherit from this reporter, providing
* stats such as test duration, number
* of tests passed / failed etc.
* inherit from this reporter.
*

@@ -287,39 +271,14 @@ * @memberof Mocha.reporters

* @param {Runner} runner
* @api public
*/
function Base(runner) {
var stats = (this.stats = {
suites: 0,
tests: 0,
passes: 0,
pending: 0,
failures: 0
});
var failures = (this.failures = []);
if (!runner) {
return;
throw new TypeError('Missing runner argument');
}
this.stats = runner.stats; // assigned so Reporters keep a closer reference
this.runner = runner;
runner.stats = stats;
runner.on('start', function() {
stats.start = new Date();
});
runner.on('suite', function(suite) {
stats.suites = stats.suites || 0;
suite.root || stats.suites++;
});
runner.on('test end', function() {
stats.tests = stats.tests || 0;
stats.tests++;
});
runner.on('pass', function(test) {
stats.passes = stats.passes || 0;
if (test.duration > test.slow()) {

@@ -332,9 +291,5 @@ test.speed = 'slow';

}
stats.passes++;
});
runner.on('fail', function(test, err) {
stats.failures = stats.failures || 0;
stats.failures++;
if (showDiff(err)) {

@@ -346,11 +301,2 @@ stringifyDiffObjs(err);

});
runner.once('end', function() {
stats.end = new Date();
stats.duration = stats.end - stats.start;
});
runner.on('pending', function() {
stats.pending++;
});
}

@@ -364,3 +310,2 @@

* @public
* @api public
*/

@@ -379,3 +324,3 @@ Base.prototype.epilogue = function() {

console.log(fmt, stats.passes || 0, ms(stats.duration));
console.log(fmt, stats.passes || 0, milliseconds(stats.duration));

@@ -405,3 +350,3 @@ // pending

*
* @api private
* @private
* @param {string} str

@@ -419,3 +364,3 @@ * @param {string} len

*
* @api private
* @private
* @param {String} actual

@@ -457,3 +402,3 @@ * @param {String} expected

*
* @api private
* @private
* @param {String} actual

@@ -501,3 +446,3 @@ * @param {String} expected

*
* @api private
* @private
* @param {String} actual

@@ -525,3 +470,3 @@ * @param {String} expected

*
* @api private
* @private
* @param {string} name

@@ -548,3 +493,3 @@ * @param {string} str

*
* @api private
* @private
* @param {Object} a

@@ -557,1 +502,3 @@ * @param {Object} b

}
Base.abstract = true;

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

* @param {Runner} runner
* @api public
*/

@@ -80,1 +79,3 @@ function Doc(runner) {

}
Doc.description = 'HTML documentation';

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

var inherits = require('../utils').inherits;
var color = Base.color;

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

* @public
* @api public
* @param {Runner} runner

@@ -46,3 +44,3 @@ */

}
process.stdout.write(color('pending', Base.symbols.comma));
process.stdout.write(Base.color('pending', Base.symbols.comma));
});

@@ -55,5 +53,5 @@

if (test.speed === 'slow') {
process.stdout.write(color('bright yellow', Base.symbols.dot));
process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
} else {
process.stdout.write(color(test.speed, Base.symbols.dot));
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
}

@@ -66,3 +64,3 @@ });

}
process.stdout.write(color('fail', Base.symbols.bang));
process.stdout.write(Base.color('fail', Base.symbols.bang));
});

@@ -80,1 +78,3 @@

inherits(Dot, Base);
Dot.description = 'dot matrix representation';

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

/* eslint-disable no-unused-vars, no-native-reassign */
var Date = global.Date;
var setTimeout = global.setTimeout;
var setInterval = global.setInterval;
var clearTimeout = global.clearTimeout;
var clearInterval = global.clearInterval;
/* eslint-enable no-unused-vars, no-native-reassign */

@@ -57,3 +51,2 @@ /**

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -238,3 +231,3 @@ */

// TODO: add to stats
var percent = (stats.tests / runner.total * 100) | 0;
var percent = ((stats.tests / runner.total) * 100) | 0;
if (progress) {

@@ -392,1 +385,3 @@ progress.update(percent).draw(ctx);

}
HTML.browserOnly = true;

@@ -12,19 +12,17 @@ 'use strict';

/**
* Expose `List`.
* Expose `JSONStream`.
*/
exports = module.exports = List;
exports = module.exports = JSONStream;
/**
* Initialize a new `JSONStream` test reporter.
* Constructs a new `JSONStream` reporter instance.
*
* @public
* @name JSONStream
* @class JSONStream
* @class
* @extends Mocha.reporters.Base
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner
* @param {Runner} runner - Instance triggers reporter actions.
*/
function List(runner) {
function JSONStream(runner) {
Base.call(this, runner);

@@ -35,8 +33,8 @@

runner.on('start', function() {
console.log(JSON.stringify(['start', {total: total}]));
runner.once('start', function() {
writeEvent(['start', {total: total}]);
});
runner.on('pass', function(test) {
console.log(JSON.stringify(['pass', clean(test)]));
writeEvent(['pass', clean(test)]);
});

@@ -48,7 +46,7 @@

test.stack = err.stack || null;
console.log(JSON.stringify(['fail', test]));
writeEvent(['fail', test]);
});
runner.once('end', function() {
process.stdout.write(JSON.stringify(['end', self.stats]));
writeEvent(['end', self.stats]);
});

@@ -58,9 +56,24 @@ }

/**
* Return a plain-object representation of `test`
* free of cyclic properties etc.
* Mocha event to be written to the output stream.
* @typedef {Array} JSONStream~MochaEvent
*/
/**
* Writes Mocha event to reporter output stream.
*
* @api private
* @param {Object} test
* @return {Object}
* @private
* @param {JSONStream~MochaEvent} event - Mocha event to be output.
*/
function writeEvent(event) {
process.stdout.write(JSON.stringify(event) + '\n');
}
/**
* Returns an object literal representation of `test`
* free of cyclic properties, etc.
*
* @private
* @param {Test} test - Instance used as data source.
* @return {Object} object containing pared-down test instance data
*/
function clean(test) {

@@ -74,1 +87,3 @@ return {

}
JSONStream.description = 'newline delimited JSON events';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -72,3 +71,3 @@ */

*
* @api private
* @private
* @param {Object} test

@@ -95,3 +94,3 @@ * @return {Object}

*
* @api private
* @private
* @param {Object} obj

@@ -120,3 +119,3 @@ * @return {Object}

*
* @api private
* @private
* @param {Error} err

@@ -132,1 +131,3 @@ * @return {Object}

}
JSONReporter.description = 'single JSON object';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -72,3 +71,3 @@ */

// check if the plane crashed
var col = crashed === -1 ? (width * ++n / total) | 0 : crashed;
var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;

@@ -103,1 +102,3 @@ // show the crash

inherits(Landing, Base);
Landing.description = 'Unicode landing strip';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -71,1 +70,3 @@ */

inherits(List, Base);
List.description = 'like "spec" reporter but flat';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -107,1 +106,3 @@ */

}
Markdown.description = 'GitHub Flavored Markdown';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -46,1 +45,3 @@ */

inherits(Min, Base);
Min.description = 'essentially just a summary';

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

* @param {Runner} runner
* @api public
* @public

@@ -79,3 +78,3 @@ * @class Nyan

*
* @api private
* @private
*/

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

*
* @api private
* @private
*/

@@ -119,3 +118,3 @@

*
* @api private
* @private
*/

@@ -139,3 +138,3 @@

*
* @api private
* @private
*/

@@ -158,3 +157,3 @@

*
* @api private
* @private
*/

@@ -193,3 +192,3 @@ NyanCat.prototype.drawNyanCat = function() {

*
* @api private
* @private
* @return {string}

@@ -213,3 +212,3 @@ */

*
* @api private
* @private
* @param {number} n

@@ -225,3 +224,3 @@ */

*
* @api private
* @private
* @param {number} n

@@ -237,3 +236,3 @@ */

*
* @api private
* @private
* @return {Array}

@@ -259,3 +258,3 @@ */

*
* @api private
* @private
* @param {string} str

@@ -281,1 +280,3 @@ * @return {string}

}
NyanCat.description = '"nyan cat"';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -101,1 +100,3 @@ * @param {Object} options

inherits(Progress, Base);
Progress.description = 'a progress bar';

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

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -91,1 +90,3 @@ */

inherits(Spec, Base);
Spec.description = 'hierarchical & verbose [default]';

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

var util = require('util');
var Base = require('./base');
var inherits = require('../utils').inherits;
var sprintf = util.format;

@@ -19,21 +22,30 @@ /**

/**
* Initialize a new `TAP` reporter.
* Constructs a new TAP reporter with runner instance and reporter options.
*
* @public
* @class
* @extends Mocha.reporters.Base
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner
* @param {Runner} runner - Instance triggers reporter actions.
* @param {Object} [options] - runner options
*/
function TAP(runner) {
Base.call(this, runner);
function TAP(runner, options) {
Base.call(this, runner, options);
var self = this;
var n = 1;
var passes = 0;
var failures = 0;
runner.on('start', function() {
var total = runner.grepTotal(runner.suite);
console.log('%d..%d', 1, total);
var tapVersion = '12';
if (options && options.reporterOptions) {
if (options.reporterOptions.tapVersion) {
tapVersion = options.reporterOptions.tapVersion.toString();
}
}
this._producer = createProducer(tapVersion);
runner.once('start', function() {
var ntests = runner.grepTotal(runner.suite);
self._producer.writeVersion();
self._producer.writePlan(ntests);
});

@@ -46,22 +58,15 @@

runner.on('pending', function(test) {
console.log('ok %d %s # SKIP -', n, title(test));
self._producer.writePending(n, test);
});
runner.on('pass', function(test) {
passes++;
console.log('ok %d %s', n, title(test));
self._producer.writePass(n, test);
});
runner.on('fail', function(test, err) {
failures++;
console.log('not ok %d %s', n, title(test));
if (err.stack) {
console.log(err.stack.replace(/^/gm, ' '));
}
self._producer.writeFail(n, test, err);
});
runner.once('end', function() {
console.log('# tests ' + (passes + failures));
console.log('# pass ' + passes);
console.log('# fail ' + failures);
self._producer.writeEpilogue(runner.stats);
});

@@ -71,7 +76,12 @@ }

/**
* Return a TAP-safe title of `test`
* Inherit from `Base.prototype`.
*/
inherits(TAP, Base);
/**
* Returns a TAP-safe title of `test`.
*
* @api private
* @param {Object} test
* @return {String}
* @private
* @param {Test} test - Test instance.
* @return {String} title with any hash character removed
*/

@@ -81,1 +91,202 @@ function title(test) {

}
/**
* Writes newline-terminated formatted string to reporter output stream.
*
* @private
* @param {string} format - `printf`-like format string
* @param {...*} [varArgs] - Format string arguments
*/
function println(format, varArgs) {
var vargs = Array.from(arguments);
vargs[0] += '\n';
process.stdout.write(sprintf.apply(null, vargs));
}
/**
* Returns a `tapVersion`-appropriate TAP producer instance, if possible.
*
* @private
* @param {string} tapVersion - Version of TAP specification to produce.
* @returns {TAPProducer} specification-appropriate instance
* @throws {Error} if specification version has no associated producer.
*/
function createProducer(tapVersion) {
var producers = {
'12': new TAP12Producer(),
'13': new TAP13Producer()
};
var producer = producers[tapVersion];
if (!producer) {
throw new Error(
'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
);
}
return producer;
}
/**
* @summary
* Constructs a new TAPProducer.
*
* @description
* <em>Only</em> to be used as an abstract base class.
*
* @private
* @constructor
*/
function TAPProducer() {}
/**
* Writes the TAP version to reporter output stream.
*
* @abstract
*/
TAPProducer.prototype.writeVersion = function() {};
/**
* Writes the plan to reporter output stream.
*
* @abstract
* @param {number} ntests - Number of tests that are planned to run.
*/
TAPProducer.prototype.writePlan = function(ntests) {
println('%d..%d', 1, ntests);
};
/**
* Writes that test passed to reporter output stream.
*
* @abstract
* @param {number} n - Index of test that passed.
* @param {Test} test - Instance containing test information.
*/
TAPProducer.prototype.writePass = function(n, test) {
println('ok %d %s', n, title(test));
};
/**
* Writes that test was skipped to reporter output stream.
*
* @abstract
* @param {number} n - Index of test that was skipped.
* @param {Test} test - Instance containing test information.
*/
TAPProducer.prototype.writePending = function(n, test) {
println('ok %d %s # SKIP -', n, title(test));
};
/**
* Writes that test failed to reporter output stream.
*
* @abstract
* @param {number} n - Index of test that failed.
* @param {Test} test - Instance containing test information.
* @param {Error} err - Reason the test failed.
*/
TAPProducer.prototype.writeFail = function(n, test, err) {
println('not ok %d %s', n, title(test));
};
/**
* Writes the summary epilogue to reporter output stream.
*
* @abstract
* @param {Object} stats - Object containing run statistics.
*/
TAPProducer.prototype.writeEpilogue = function(stats) {
// :TBD: Why is this not counting pending tests?
println('# tests ' + (stats.passes + stats.failures));
println('# pass ' + stats.passes);
// :TBD: Why are we not showing pending results?
println('# fail ' + stats.failures);
};
/**
* @summary
* Constructs a new TAP12Producer.
*
* @description
* Produces output conforming to the TAP12 specification.
*
* @private
* @constructor
* @extends TAPProducer
* @see {@link https://testanything.org/tap-specification.html|Specification}
*/
function TAP12Producer() {
/**
* Writes that test failed to reporter output stream, with error formatting.
* @override
*/
this.writeFail = function(n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);
if (err.message) {
println(err.message.replace(/^/gm, ' '));
}
if (err.stack) {
println(err.stack.replace(/^/gm, ' '));
}
};
}
/**
* Inherit from `TAPProducer.prototype`.
*/
inherits(TAP12Producer, TAPProducer);
/**
* @summary
* Constructs a new TAP13Producer.
*
* @description
* Produces output conforming to the TAP13 specification.
*
* @private
* @constructor
* @extends TAPProducer
* @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
*/
function TAP13Producer() {
/**
* Writes the TAP version to reporter output stream.
* @override
*/
this.writeVersion = function() {
println('TAP version 13');
};
/**
* Writes that test failed to reporter output stream, with error formatting.
* @override
*/
this.writeFail = function(n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);
var emitYamlBlock = err.message != null || err.stack != null;
if (emitYamlBlock) {
println(indent(1) + '---');
if (err.message) {
println(indent(2) + 'message: |-');
println(err.message.replace(/^/gm, indent(3)));
}
if (err.stack) {
println(indent(2) + 'stack: |-');
println(err.stack.replace(/^/gm, indent(3)));
}
println(indent(1) + '...');
}
};
function indent(level) {
return Array(level + 1).join(' ');
}
}
/**
* Inherit from `TAPProducer.prototype`.
*/
inherits(TAP13Producer, TAPProducer);
TAP.description = 'TAP-compatible output';

@@ -16,14 +16,8 @@ 'use strict';

var path = require('path');
var errors = require('../errors');
var createNotSupportedError = errors.createNotSupportedError;
/**
* Save timer references to avoid Sinon interfering (see GH-237).
*/
/* eslint-disable no-unused-vars, no-native-reassign */
var Date = global.Date;
var setTimeout = global.setTimeout;
var setInterval = global.setInterval;
var clearTimeout = global.clearTimeout;
var clearInterval = global.clearInterval;
/* eslint-enable no-unused-vars, no-native-reassign */

@@ -43,3 +37,2 @@ /**

* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner

@@ -63,3 +56,3 @@ */

if (!fs.createWriteStream) {
throw new Error('file output not supported in browser');
throw createNotSupportedError('file output not supported in browser');
}

@@ -97,3 +90,3 @@

tests: stats.tests,
failures: stats.failures,
failures: 0,
errors: stats.failures,

@@ -158,2 +151,4 @@ skipped: stats.tests - stats.failures - stats.passes,

XUnit.prototype.test = function(test) {
Base.useColors = false;
var attrs = {

@@ -167,2 +162,6 @@ classname: test.parent.fullTitle(),

var err = test.err;
var diff =
Base.hideDiff || !err.actual || !err.expected
? ''
: '\n' + Base.generateDiff(err.actual, err.expected);
this.write(

@@ -177,3 +176,3 @@ tag(

false,
escape(err.message) + '\n' + escape(err.stack)
escape(err.message) + escape(diff) + '\n' + escape(err.stack)
)

@@ -215,1 +214,3 @@ )

}
XUnit.description = 'XUnit-compatible XML output';

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

var debug = require('debug')('mocha:runnable');
var milliseconds = require('./ms');
var milliseconds = require('ms');
var utils = require('./utils');

@@ -12,11 +12,5 @@

*/
/* eslint-disable no-unused-vars, no-native-reassign */
var Date = global.Date;
var setTimeout = global.setTimeout;
var setInterval = global.setInterval;
var clearTimeout = global.clearTimeout;
var clearInterval = global.clearInterval;
/* eslint-enable no-unused-vars, no-native-reassign */
var toString = Object.prototype.toString;

@@ -55,8 +49,22 @@

/**
* Set & get timeout `ms`.
* Get current timeout value in msecs.
*
* @api private
* @param {number|string} ms
* @return {Runnable|number} ms or Runnable instance.
* @private
* @returns {number} current timeout threshold value
*/
/**
* @summary
* Set timeout threshold value (msecs).
*
* @description
* A string argument can use shorthand (e.g., "2s") and will be converted.
* The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
* If clamped value matches either range endpoint, timeouts will be disabled.
*
* @private
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
* @param {number|string} ms - Timeout threshold value.
* @returns {Runnable} this
* @chainable
*/
Runnable.prototype.timeout = function(ms) {

@@ -66,9 +74,15 @@ if (!arguments.length) {

}
if (typeof ms === 'string') {
ms = milliseconds(ms);
}
// Clamp to range
var INT_MAX = Math.pow(2, 31) - 1;
var range = [0, INT_MAX];
ms = utils.clamp(ms, range);
// see #1652 for reasoning
if (ms === 0 || ms > Math.pow(2, 31)) {
if (ms === range[0] || ms === range[1]) {
this._enableTimeouts = false;
}
if (typeof ms === 'string') {
ms = milliseconds(ms);
}
debug('timeout %d', ms);

@@ -85,3 +99,3 @@ this._timeout = ms;

*
* @api private
* @private
* @param {number|string} ms

@@ -105,3 +119,3 @@ * @return {Runnable|number} ms or Runnable instance.

*
* @api private
* @private
* @param {boolean} enabled

@@ -124,3 +138,2 @@ * @return {Runnable|boolean} enabled or Runnable instance.

* @public
* @api public
*/

@@ -134,3 +147,3 @@ Runnable.prototype.skip = function() {

*
* @api private
* @private
*/

@@ -162,3 +175,3 @@ Runnable.prototype.isPending = function() {

*
* @api private
* @private
*/

@@ -175,3 +188,3 @@ Runnable.prototype.retries = function(n) {

*
* @api private
* @private
*/

@@ -191,3 +204,2 @@ Runnable.prototype.currentRetry = function(n) {

* @public
* @api public
* @return {string}

@@ -204,3 +216,2 @@ */

* @public
* @api public
* @return {string}

@@ -215,3 +226,3 @@ */

*
* @api private
* @private
*/

@@ -225,3 +236,3 @@ Runnable.prototype.clearTimeout = function() {

*
* @api private
* @private
* @return {string}

@@ -251,3 +262,3 @@ */

*
* @api private
* @private
*/

@@ -274,3 +285,3 @@ Runnable.prototype.resetTimeout = function() {

*
* @api private
* @private
* @param {string[]} globals

@@ -289,3 +300,3 @@ */

* @param {Function} fn
* @api private
* @private
*/

@@ -292,0 +303,0 @@ Runnable.prototype.run = function(fn) {

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

var Runnable = require('./runnable');
var createStatsCollector = require('./stats-collector');
var stackFilter = utils.stackTraceFilter();

@@ -62,3 +63,2 @@ var stringify = utils.stringify;

* @class
* @api public
* @param {Suite} [suite] Root suite

@@ -86,2 +86,3 @@ * @param {boolean} [delay] Whether or not to delay execution of root suite

this.globals(this.globalProps().concat(extraGlobals()));
createStatsCollector(this);
}

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

* @param {Function} fn
* @api private
* @private
*/

@@ -107,3 +108,2 @@ Runner.immediately = global.setImmediate || process.nextTick;

*
* @api public
* @public

@@ -128,3 +128,2 @@ * @memberof Mocha.Runner

* @memberof Mocha.Runner
* @api public
* @public

@@ -155,3 +154,3 @@ * @param {Suite} suite

* @return {Array}
* @api private
* @private
*/

@@ -175,3 +174,2 @@ Runner.prototype.globalProps = function() {

*
* @api public
* @public

@@ -194,3 +192,3 @@ * @memberof Mocha.Runner

*
* @api private
* @private
*/

@@ -231,3 +229,3 @@ Runner.prototype.checkGlobals = function(test) {

*
* @api private
* @private
* @param {Test} test

@@ -244,10 +242,4 @@ * @param {Error} err

if (!(err instanceof Error || (err && typeof err.message === 'string'))) {
err = new Error(
'the ' +
type(err) +
' ' +
stringify(err) +
' was thrown, throw an Error :)'
);
if (!isError(err)) {
err = thrown2Error(err);
}

@@ -263,5 +255,2 @@

this.emit('fail', test, err);
if (this.suite.bail()) {
this.emit('end');
}
};

@@ -273,3 +262,4 @@

* Hook failures work in the following pattern:
* - If bail, then exit
* - If bail, run corresponding `after each` and `after` hooks,
* then exit
* - Failed `before` hook skips all tests in a suite and subsuites,

@@ -286,3 +276,3 @@ * but jumps to corresponding `after` hook

*
* @api private
* @private
* @param {Hook} hook

@@ -304,3 +294,3 @@ * @param {Error} err

*
* @api private
* @private
* @param {string} name

@@ -345,2 +335,5 @@ * @param {Function} fn

});
suite.suites.forEach(function(suite) {
suite.pending = true;
});
// a pending hook won't be executed twice.

@@ -371,3 +364,3 @@ hook.pending = true;

*
* @api private
* @private
* @param {string} name

@@ -408,3 +401,3 @@ * @param {Array} suites

* @param {Function} fn
* @api private
* @private
*/

@@ -421,3 +414,3 @@ Runner.prototype.hookUp = function(name, fn) {

* @param {Function} fn
* @api private
* @private
*/

@@ -434,3 +427,3 @@ Runner.prototype.hookDown = function(name, fn) {

* @return {Array}
* @api private
* @private
*/

@@ -451,3 +444,3 @@ Runner.prototype.parents = function() {

* @param {Function} fn
* @api private
* @private
*/

@@ -485,3 +478,3 @@ Runner.prototype.runTest = function(fn) {

*
* @api private
* @private
* @param {Suite} suite

@@ -524,3 +517,3 @@ * @param {Function} fn

if (self.failures && suite._bail) {
return fn();
tests = [];
}

@@ -610,2 +603,4 @@

self.emit('retry', test, err);
// Early return + hook trigger so that it doesn't

@@ -646,3 +641,3 @@ // increment the count wrong

*
* @api private
* @private
* @param {Suite} suite

@@ -734,3 +729,3 @@ * @param {Function} fn

* @param {Error} err
* @api private
* @private
*/

@@ -742,5 +737,5 @@ Runner.prototype.uncaught = function(err) {

err ===
function() {
return this;
}.call(err)
function() {
return this;
}.call(err)
? err.message || err

@@ -753,2 +748,6 @@ : err

}
if (!isError(err)) {
err = thrown2Error(err);
}
err.uncaught = true;

@@ -854,3 +853,2 @@

*
* @api public
* @public

@@ -877,6 +875,11 @@ * @memberof Mocha.Runner

self.started = true;
self.emit('start');
Runner.immediately(function() {
self.emit('start');
});
self.runSuite(rootSuite, function() {
debug('finished running');
self.emit('end');
Runner.immediately(function() {
self.emit('end');
});
});

@@ -917,3 +920,2 @@ }

* @public
* @api public
* @return {Runner} Runner instance.

@@ -933,3 +935,3 @@ */

* @returns {Boolean}
* @api private
* @private
*/

@@ -967,3 +969,3 @@ function filterOnly(suite) {

* @returns {Boolean}
* @api private
* @private
*/

@@ -981,3 +983,3 @@ function hasOnly(suite) {

*
* @api private
* @private
* @param {Array} ok

@@ -1023,6 +1025,32 @@ * @param {Array} globals

/**
* Check if argument is an instance of Error object or a duck-typed equivalent.
*
* @private
* @param {Object} err - object to check
* @param {string} err.message - error message
* @returns {boolean}
*/
function isError(err) {
return err instanceof Error || (err && typeof err.message === 'string');
}
/**
*
* Converts thrown non-extensible type into proper Error.
*
* @private
* @param {*} thrown - Non-extensible type thrown by code
* @return {Error}
*/
function thrown2Error(err) {
return new Error(
'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
);
}
/**
* Array of globals dependent on the environment.
*
* @return {Array}
* @api private
* @private
*/

@@ -1029,0 +1057,0 @@ function extraGlobals() {

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

var debug = require('debug')('mocha:suite');
var milliseconds = require('./ms');
var milliseconds = require('ms');
var errors = require('./errors');
var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;

@@ -30,3 +32,2 @@ /**

* @public
* @api public
* @param {Suite} parent

@@ -55,6 +56,8 @@ * @param {string} title

if (!utils.isString(title)) {
throw new Error(
'Suite `title` should be a "string" but "' +
throw createInvalidArgumentTypeError(
'Suite argument "title" must be a string. Received type "' +
typeof title +
'" was given instead.'
'"',
'title',
'string'
);

@@ -92,3 +95,3 @@ }

*
* @api private
* @private
* @return {Suite}

@@ -111,3 +114,3 @@ */

*
* @api private
* @private
* @param {number|string} ms

@@ -134,3 +137,3 @@ * @return {Suite|number} for chaining

*
* @api private
* @private
* @param {number|string} n

@@ -151,3 +154,3 @@ * @return {Suite|number} for chaining

*
* @api private
* @private
* @param {boolean} enabled

@@ -168,3 +171,3 @@ * @return {Suite|boolean} self or enabled

*
* @api private
* @private
* @param {number|string} ms

@@ -188,3 +191,3 @@ * @return {Suite|number} for chaining

*
* @api private
* @private
* @param {boolean} bail

@@ -205,3 +208,3 @@ * @return {Suite|number} for chaining

*
* @api private
* @private
*/

@@ -234,3 +237,3 @@ Suite.prototype.isPending = function() {

*
* @api private
* @private
* @param {string} title

@@ -259,3 +262,3 @@ * @param {Function} fn

*
* @api private
* @private
* @param {string} title

@@ -284,3 +287,3 @@ * @param {Function} fn

*
* @api private
* @private
* @param {string} title

@@ -309,3 +312,3 @@ * @param {Function} fn

*
* @api private
* @private
* @param {string} title

@@ -334,3 +337,3 @@ * @param {Function} fn

*
* @api private
* @private
* @param {Suite} suite

@@ -354,3 +357,3 @@ * @return {Suite} for chaining

*
* @api private
* @private
* @param {Test} test

@@ -377,3 +380,2 @@ * @return {Suite} for chaining

* @public
* @api public
* @return {string}

@@ -391,3 +393,2 @@ */

* @public
* @api public
* @return {string}

@@ -411,3 +412,2 @@ */

* @public
* @api public
* @return {number}

@@ -427,3 +427,3 @@ */

*
* @api private
* @private
* @param {Function} fn

@@ -430,0 +430,0 @@ * @return {Suite}

'use strict';
var Runnable = require('./runnable');
var utils = require('./utils');
var errors = require('./errors');
var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
var isString = utils.isString;

@@ -18,6 +20,8 @@

if (!isString(title)) {
throw new Error(
'Test `title` should be a "string" but "' +
throw createInvalidArgumentTypeError(
'Test argument "title" should be a string. Received type "' +
typeof title +
'" was given instead.'
'"',
'title',
'string'
);

@@ -24,0 +28,0 @@ }

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

var he = require('he');
var errors = require('./errors');
var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
var createMissingArgumentError = errors.createMissingArgumentError;
var createUndefinedError = errors.createUndefinedError;

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

*
* @api private
* @private
* @param {string} html

@@ -42,3 +46,3 @@ * @return {string}

*
* @api private
* @private
* @param {Object} obj

@@ -55,3 +59,3 @@ * @return {boolean}

*
* @api private
* @private
* @param {Array} files

@@ -75,3 +79,3 @@ * @param {Function} fn

*
* @api private
* @private
* @param {string} path

@@ -87,3 +91,3 @@ * @return {boolean}

*
* @api private
* @private
* @param {string} dir

@@ -100,4 +104,3 @@ * @param {string[]} [ext=['.js']]

fs
.readdirSync(dir)
fs.readdirSync(dir)
.filter(ignored)

@@ -119,3 +122,3 @@ .forEach(function(path) {

*
* @api private
* @private
* @param {string} str

@@ -162,3 +165,3 @@ * @return {string}

*
* @api private
* @private
* @param {string} qs

@@ -186,3 +189,3 @@ * @return {Object}

*
* @api private
* @private
* @param {string} js

@@ -212,3 +215,3 @@ * @return {string}

*
* @api private
* @private
* @param {string} name

@@ -232,3 +235,3 @@ */

*
* @api private
* @private
* @param {*} value The value to inspect.

@@ -255,3 +258,3 @@ * @param {string} typeHint The type of the value

*
* @api private
* @private
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString

@@ -297,3 +300,3 @@ * @param {*} value The value to test.

*
* @api private
* @private
* @see exports.type

@@ -344,3 +347,3 @@ * @param {*} value

*
* @api private
* @private
* @param {Object} object

@@ -440,3 +443,3 @@ * @param {number=} spaces

*
* @api private
* @private
* @see {@link exports.stringify}

@@ -520,6 +523,6 @@ * @param {*} value Thing to inspect. May or may not have properties.

* @public
* @api public
* @param {string} filepath Base path to start searching from.
* @param {string[]} extensions File extensions to look for.
* @param {boolean} recursive Whether or not to recurse into subdirectories.
* @todo Fix extension handling
* @return {string[]} An array of paths.

@@ -536,3 +539,6 @@ */

if (!files.length) {
throw new Error("cannot resolve path (or pattern) '" + filepath + "'");
throw createNoFilesMatchPatternError(
'cannot find any files matching pattern "' + filepath + '"',
filepath
);
}

@@ -568,4 +574,6 @@ return files;

if (!extensions) {
throw new Error(
'extensions parameter required when filepath is a directory'
throw createMissingArgumentError(
'Argument "extensions" required when argument "filepath" is a directory',
'extensions',
'array'
);

@@ -590,3 +598,3 @@ }

exports.undefinedError = function() {
return new Error(
return createUndefinedError(
'Caught undefined error, did you throw without specifying what?'

@@ -608,2 +616,22 @@ );

/**
* Show a deprecation warning. Each distinct message is only displayed once.
*
* @param {string} msg
*/
exports.deprecate = function deprecate(msg) {
msg = String(msg);
if (msg && !deprecate.cache[msg]) {
deprecate.cache[msg] = true;
if (process.emitWarning) {
process.emitWarning(msg, 'DeprecationWarning');
} else {
process.nextTick(function() {
console.warn(msg);
});
}
}
};
exports.deprecate.cache = {};
/**
* @summary

@@ -679,3 +707,3 @@ * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)

* Crude, but effective.
* @api
* @public
* @param {*} value

@@ -685,9 +713,24 @@ * @returns {boolean} Whether or not `value` is a Promise

exports.isPromise = function isPromise(value) {
return typeof value === 'object' && typeof value.then === 'function';
return (
typeof value === 'object' &&
value !== null &&
typeof value.then === 'function'
);
};
/**
* Clamps a numeric value to an inclusive range.
*
* @param {number} value - Value to be clamped.
* @param {numer[]} range - Two element array specifying [min, max] range.
* @returns {number} clamped value
*/
exports.clamp = function clamp(value, range) {
return Math.min(Math.max(value, range[0]), range[1]);
};
/**
* It's a noop.
* @api
* @public
*/
exports.noop = function() {};
{
"name": "mocha",
"version": "5.2.0",
"version": "6.0.0-0",
"description": "simple, flexible, fun test framework",

@@ -59,2 +59,3 @@ "keywords": [

"Ben Bradley <ben@bradleyit.com>",
"Ben Glassman <benglass@users.noreply.github.com>",
"Ben Harris <benhdev@gmail.com>",

@@ -78,2 +79,3 @@ "Ben Hutchison <ben@aldaviva.com>",

"Brian Moore <guardbionic-github@yahoo.com>",
"Brittany Moore <moore.brittanyann@gmail.com>",
"Bryan Donovan <bdondo@gmail.com>",

@@ -88,2 +90,3 @@ "Buck Doyle <b@chromatin.ca>",

"Charles Merriam <charles.merriam@gmail.com>",
"Charles Samborski <demurgos@demurgos.net>",
"Charlie Rudolph <charles.w.rudolph@gmail.com>",

@@ -137,3 +140,5 @@ "Chris <chrisleck@users.noreply.github.com>",

"Fabio M. Costa <fabiomcosta@gmail.com>",
"Fábio Santos <fabiosantosart@gmail.com>",
"Fagner Brack <github3@fagnermartins.com>",
"fargies <fargies@users.noreply.github.com>",
"FARKAS Máté <mate.farkas@virtual-call-center.eu>",

@@ -144,2 +149,3 @@ "fcrisci <fabio.crisci@amadeus.com>",

"fengmk2 <fengmk2@gmail.com>",
"Fin Chen <finfin@gmail.com>",
"Florian Margaine <florian@margaine.com>",

@@ -161,2 +167,3 @@ "FND <FND@users.noreply.github.com>",

"Giovanni Bassi <giggio@giggio.net>",
"gizemkeser <44727928+gizemkeser@users.noreply.github.com>",
"Glen Huang <curvedmark@gmail.com>",

@@ -204,2 +211,3 @@ "Glen Mailer <glenjamin@gmail.com>",

"Javier Aranda <javierav@javierav.com>",
"Jayasankar <jayasankar.m@gmail.com>",
"Jean Ponchon <gelule@gmail.com>",

@@ -241,2 +249,3 @@ "Jeff Kunkle <jeff.kunkle@nearinfinity.com>",

"jsdevel <js.developer.undefined@gmail.com>",
"Juerg B <44573692+juergba@users.noreply.github.com>",
"Julien Wajsberg <felash@gmail.com>",

@@ -277,4 +286,6 @@ "Jupp Müller <jupp0r@gmail.com>",

"Marc Kuo <kuomarc2@gmail.com>",
"Marc Udoff <mlucool@gmail.com>",
"Marcello Bastea-Forte <marcello@cellosoft.com>",
"Mark Banner <standard8@mozilla.com>",
"Mark Owsiak <mark.owsiak@gmail.com>",
"Markus Tacker <m@coderbyheart.com>",

@@ -326,2 +337,3 @@ "Martin Marko <marcus@gratex.com>",

"oveddan <stangogh@gmail.com>",
"P. Roebuck <plroebuck@users.noreply.github.com>",
"Panu Horsmalahti <panu.horsmalahti@iki.fi>",

@@ -332,2 +344,3 @@ "Parker Moore <parkrmoore@gmail.com>",

"Paul Miller <paul@paulmillr.com>",
"Paul Roebuck <plroebuck@users.noreply.github.com>",
"Pavel Zubkou <pavel.zubkou@gmail.com>",

@@ -406,2 +419,3 @@ "Pete Hawkins <pete@petes-imac.frontinternal.net>",

"Sune Simonsen <sune@we-knowhow.dk>",
"Svetlana <39729453+Lana-Light@users.noreply.github.com>",
"Tapiwa Kelvin <tapiwa@munzwa.tk>",

@@ -416,2 +430,3 @@ "Ted Yavuzkurt <hello@TedY.io>",

"Tim Ehat <timehat@gmail.com>",
"Tim Harshman <goteamtim+git@gmail.com>",
"Timo Tijhof <krinklemail@gmail.com>",

@@ -422,2 +437,3 @@ "Timothy Gu <timothygu99@gmail.com>",

"Tobias Bieniek <tobias.bieniek@gmail.com>",
"Tobias Mollstam <tobias@mollstam.com>",
"Todd Agulnick <tagulnick@onjack.com>",

@@ -461,2 +477,8 @@ "Tom Coquereau <tom@thau.me>",

},
"bugs": {
"url": "https://github.com/mochajs/mocha/issues/"
},
"homepage": "https://mochajs.org/",
"logo": "https://cldup.com/S9uQ-cOLYz.svg",
"notifyLogo": "https://ibin.co/4QuRuGjXvl36.png",
"bin": {

@@ -466,4 +488,8 @@ "mocha": "./bin/mocha",

},
"directories": {
"lib": "./lib",
"test": "./test"
},
"engines": {
"node": ">= 4.0.0"
"node": ">= 6.0.0"
},

@@ -474,38 +500,52 @@ "scripts": {

"test": "nps test",
"precommit": "lint-staged"
"version": "nps version"
},
"dependencies": {
"ansi-colors": "3.2.3",
"browser-stdout": "1.3.1",
"commander": "2.15.1",
"debug": "3.1.0",
"debug": "3.2.6",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
"glob": "7.1.2",
"findup-sync": "2.0.0",
"glob": "7.1.3",
"growl": "1.10.5",
"he": "1.1.1",
"he": "1.2.0",
"js-yaml": "3.12.0",
"log-symbols": "2.2.0",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
"supports-color": "5.4.0"
"ms": "2.1.1",
"node-environment-flags": "1.0.2",
"object.assign": "4.1.0",
"strip-json-comments": "2.0.1",
"supports-color": "6.0.0",
"which": "1.3.1",
"wide-align": "1.1.3",
"yargs": "12.0.5",
"yargs-parser": "11.1.1",
"yargs-unparser": "1.5.0"
},
"devDependencies": {
"@mocha/contributors": "^1.0.3",
"@mocha/docdash": "^1.0.1",
"assetgraph-builder": "^6.2.0",
"browserify": "^16.2.2",
"chai": "^4.1.2",
"assetgraph-builder": "^6.4.2",
"browserify": "^16.2.3",
"browserify-package-json": "^1.0.1",
"chai": "^4.2.0",
"coffee-script": "^1.10.0",
"coveralls": "^3.0.1",
"coveralls": "^3.0.2",
"cross-spawn": "^6.0.5",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.9.0",
"eslint-config-semistandard": "^12.0.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.14.3",
"eslint": "^5.10.0",
"eslint-config-prettier": "^3.3.0",
"eslint-config-semistandard": "^13.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"husky": "^1.2.1",
"jsdoc": "^3.5.5",
"karma": "^2.0.2",
"karma-browserify": "^5.0.5",
"karma": "^3.1.1",
"karma-browserify": "^5.3.0",
"karma-chrome-launcher": "^2.0.0",

@@ -515,18 +555,28 @@ "karma-mocha": "^1.3.0",

"karma-sauce-launcher": "^1.2.0",
"lint-staged": "^7.1.0",
"lint-staged": "^8.1.0",
"markdown-magic": "^0.1.25",
"markdown-magic-package-json": "^2.0.0",
"markdown-toc": "^1.2.0",
"markdownlint-cli": "^0.8.1",
"nps": "^5.7.1",
"nyc": "^11.7.3",
"prettier-eslint-cli": "^4.7.1",
"markdownlint-cli": "^0.13.0",
"nps": "^5.9.3",
"nyc": "^13.1.0",
"prettier": "^1.15.3",
"remark": "^10.0.1",
"remark-github": "^7.0.5",
"remark-inline-links": "^3.1.2",
"rewiremock": "^3.12.3",
"rimraf": "^2.5.2",
"svgo": "^1.0.5",
"through2": "^2.0.1",
"unexpected": "^10.37.7",
"sinon": "^7.1.1",
"strip-ansi": "^5.0.0",
"svgo": "^1.1.1",
"through2": "^3.0.0",
"to-vfile": "^5.0.2",
"unexpected": "^10.39.2",
"unexpected-sinon": "^10.10.1",
"watchify": "^3.7.0"
},
"files": [
"bin",
"images",
"lib",
"bin/{*mocha,options.js}",
"assets/growl/*.png",
"lib/**/*.{js,html}",
"index.js",

@@ -537,6 +587,11 @@ "mocha.css",

],
"browserify": {
"transform": [
"./scripts/package-json-cullify"
]
},
"browser": {
"growl": "./lib/browser/growl.js",
"./index.js": "./browser-entry.js",
"./lib/growl.js": "./lib/browser/growl.js",
"tty": "./lib/browser/tty.js",
"./index.js": "./browser-entry.js",
"fs": false,

@@ -547,8 +602,24 @@ "glob": false,

},
"homepage": "https://mochajs.org",
"logo": "https://cldup.com/S9uQ-cOLYz.svg",
"prettier": {
"singleQuote": true,
"bracketSpacing": false
},
"yargs": {
"combine-arrays": true,
"short-option-groups": false,
"dot-notation": false
},
"gitter": "https://gitter.im/mochajs/mocha",
"@mocha/contributors": {
"exclude": [
"greenkeeperio-bot <support@greenkeeper.io>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"TJ Holowaychuk <tj@vision-media.ca>"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}

@@ -14,5 +14,6 @@ <p align="center">

- **[Documentation](https://mochajs.org)**
- **[Documentation](https://mochajs.org/)**
- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)

@@ -19,0 +20,0 @@ - [Google Group](https://groups.google.com/group/mochajs)

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 too big to display

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