Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: mocha @ 6.0.2 .. 6.1.1

CHANGELOG.md

@@ -1,3 +1,53 @@
+# 6.1.1 / 2019-04-07
+
+## :bug: Fixes
+
+- Fix Windows End-of-Line publishing issue
+
+# 6.1.0 / 2019-04-07
+
+## :lock: Security Fixes
+
+- [#3845](https://github.com/mochajs/mocha/issues/3845): Update dependency "js-yaml" to v3.13.0 per npm security advisory ([**@plroebuck**](https://github.com/plroebuck))
+
+## :tada: Enhancements
+
+- [#3766](https://github.com/mochajs/mocha/issues/3766): Make reporter constructor support optional `options` parameter ([**@plroebuck**](https://github.com/plroebuck))
+- [#3760](https://github.com/mochajs/mocha/issues/3760): Add support for config files with `.jsonc` extension ([**@sstephant**](https://github.com/sstephant))
+
+## :fax: Deprecations
+
+These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
+
+- [#3719](https://github.com/mochajs/mocha/issues/3719): Deprecate `this.skip()` for "after all" hooks ([**@juergba**](https://github.com/juergba))
+
+## :bug: Fixes
+
+- [#3829](https://github.com/mochajs/mocha/issues/3829): Use cwd-relative pathname to load config file ([**@plroebuck**](https://github.com/plroebuck))
+- [#3745](https://github.com/mochajs/mocha/issues/3745): Fix async calls of `this.skip()` in "before each" hooks ([**@juergba**](https://github.com/juergba))
+- [#3669](https://github.com/mochajs/mocha/issues/3669): Enable `--allow-uncaught` for uncaught exceptions thrown inside hooks ([**@givanse**](https://github.com/givanse))
+
+and some regressions:
+
+- [#3848](https://github.com/mochajs/mocha/issues/3848): Fix `Suite` cloning by copying `root` property ([**@fatso83**](https://github.com/fatso83))
+- [#3816](https://github.com/mochajs/mocha/issues/3816): Guard against undefined timeout option ([**@boneskull**](https://github.com/boneskull))
+- [#3814](https://github.com/mochajs/mocha/issues/3814): Update "yargs" in order to avoid deprecation message ([**@boneskull**](https://github.com/boneskull))
+- [#3788](https://github.com/mochajs/mocha/issues/3788): Fix support for multiple node flags ([**@aginzberg**](https://github.com/aginzberg))
+
+## :book: Documentation
+
+- [mochajs/mocha-examples](https://github.com/mochajs/mocha-examples): New repository of working examples of common configurations using mocha ([**@craigtaub**](https://github.com/craigtaub))
+- [#3850](https://github.com/mochajs/mocha/issues/3850): Remove pound icon showing on header hover on docs ([**@jd2rogers2**](https://github.com/jd2rogers2))
+- [#3812](https://github.com/mochajs/mocha/issues/3812): Add autoprefixer to documentation page CSS ([**@Munter**](https://github.com/Munter))
+- [#3811](https://github.com/mochajs/mocha/issues/3811): Update doc examples "tests.html" ([**@DavidLi119**](https://github.com/DavidLi119))
+- [#3807](https://github.com/mochajs/mocha/issues/3807): Mocha website HTML tweaks ([**@plroebuck**](https://github.com/plroebuck))
+- [#3793](https://github.com/mochajs/mocha/issues/3793): Update config file example ".mocharc.yml" ([**@cspotcode**](https://github.com/cspotcode))
+
+## :nut_and_bolt: Other
+
+- [#3830](https://github.com/mochajs/mocha/issues/3830): Replace dependency "findup-sync" with "find-up" for faster startup ([**@cspotcode**](https://github.com/cspotcode))
+- [#3799](https://github.com/mochajs/mocha/issues/3799): Update devDependencies to fix many npm vulnerabilities ([**@XhmikosR**](https://github.com/XhmikosR))
+
# 6.0.2 / 2019-02-25
## :bug: Fixes
@@ -158,7 +208,6 @@
- [#3570](https://github.com/mochajs/mocha/issues/3570): Long-running tests now respect `SIGINT` ([**@boneskull**](https://github.com/boneskull))
- [#2944](https://github.com/mochajs/mocha/issues/2944): `--forbid-only` and `--forbid-pending` now "fail fast" when encountered on a suite ([**@outsideris**](https://github.com/outsideris))
- [#1652](https://github.com/mochajs/mocha/issues/1652), [#2951](https://github.com/mochajs/mocha/issues/2951): Fix broken clamping of timeout values ([**@plroebuck**](https://github.com/plroebuck))
-- [#2753](https://github.com/mochajs/mocha/issues/2753): `start` and `end` events now emitted properly from `Runner` instance when using Mocha programmatically ([**@outsideris**](https://github.com/outsideris))
- [#2095](https://github.com/mochajs/mocha/issues/2095), [#3521](https://github.com/mochajs/mocha/issues/3521): Do not log `stdout:` prefix in browser console ([**@Bamieh**](https://github.com/Bamieh))
- [#3595](https://github.com/mochajs/mocha/issues/3595): Fix mochajs.org deployment problems ([**@papandreou**](https://github.com/papandreou))
- [#3518](https://github.com/mochajs/mocha/issues/3518): Improve `utils.isPromise()` ([**@fabiosantoscode**](https://github.com/fabiosantoscode))

lib/browser/template.html

@@ -1,10 +1,10 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
+ <meta charset="utf-8">
<title>Mocha</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="mocha.css" />
+ <link rel="stylesheet" href="mocha.css">
</head>
<body>
<div id="mocha"></div>

lib/cli/cli.js

@@ -13,7 +13,7 @@
const symbols = require('log-symbols');
const yargs = require('yargs');
const path = require('path');
-const {loadOptions} = require('./options');
+const {loadOptions, YARGS_PARSER_CONFIG} = require('./options');
const commands = require('./commands');
const ansi = require('ansi-colors');
const {repository, homepage, version, gitter} = require('../../package.json');
@@ -59,6 +59,7 @@
Docs: ${ansi.yellow(homepage)}
`
)
+ .parserConfiguration(YARGS_PARSER_CONFIG)
.parse(argv, loadOptions(argv));
};

lib/cli/config.js

@@ -9,9 +9,9 @@
*/
const fs = require('fs');
-const findUp = require('findup-sync');
const path = require('path');
const debug = require('debug')('mocha:cli:config');
+const findUp = require('find-up');
/**
* These are the valid config files, in order of precedence;
@@ -24,9 +24,14 @@
'.mocharc.js',
'.mocharc.yaml',
'.mocharc.yml',
+ '.mocharc.jsonc',
'.mocharc.json'
];
+const isModuleNotFoundError = err =>
+ err.code !== 'MODULE_NOT_FOUND' ||
+ err.message.indexOf('Cannot find module') !== -1;
+
/**
* Parsers for various config filetypes. Each accepts a filepath and
* returns an object (but could throw)
@@ -34,7 +39,20 @@
const parsers = (exports.parsers = {
yaml: filepath =>
require('js-yaml').safeLoad(fs.readFileSync(filepath, 'utf8')),
- js: filepath => require(filepath),
+ js: filepath => {
+ const cwdFilepath = path.resolve(filepath);
+ try {
+ debug(`parsers: load using cwd-relative path: "${cwdFilepath}"`);
+ return require(cwdFilepath);
+ } catch (err) {
+ if (isModuleNotFoundError(err)) {
+ debug(`parsers: retry load as module-relative path: "${filepath}"`);
+ return require(filepath);
+ } else {
+ throw err; // rethrow
+ }
+ }
+ },
json: filepath =>
JSON.parse(
require('strip-json-comments')(fs.readFileSync(filepath, 'utf8'))
@@ -44,15 +62,18 @@
/**
* Loads and parses, based on file extension, a config file.
* "JSON" files may have comments.
+ *
+ * @private
* @param {string} filepath - Config file path to load
* @returns {Object} Parsed config object
- * @private
*/
exports.loadConfig = filepath => {
let config = {};
+ debug(`loadConfig: "${filepath}"`);
+
const ext = path.extname(filepath);
try {
- if (/\.ya?ml/.test(ext)) {
+ if (ext === '.yml' || ext === '.yaml') {
config = parsers.yaml(filepath);
} else if (ext === '.js') {
config = parsers.js(filepath);
@@ -60,20 +81,21 @@
config = parsers.json(filepath);
}
} catch (err) {
- throw new Error(`failed to parse ${filepath}: ${err}`);
+ throw new Error(`failed to parse config "${filepath}": ${err}`);
}
return config;
};
/**
* Find ("find up") config file starting at `cwd`
+ *
* @param {string} [cwd] - Current working directory
* @returns {string|null} Filepath to config, if found
*/
exports.findConfig = (cwd = process.cwd()) => {
- const filepath = findUp(exports.CONFIG_FILES, {cwd});
+ const filepath = findUp.sync(exports.CONFIG_FILES, {cwd});
if (filepath) {
- debug(`found config at ${filepath}`);
+ debug(`findConfig: found "${filepath}"`);
}
return filepath;
};

lib/cli/node-flags.js

@@ -81,5 +81,6 @@
.split(/\b/)
.map(arg => (arg === ' ' ? '=' : arg))
.join('')
+ .split(' ')
: [];
};

lib/cli/options.js

@@ -11,10 +11,9 @@
const {types, aliases} = require('./run-option-metadata');
const {ONE_AND_DONE_ARGS} = require('./one-and-dones');
const mocharc = require('../mocharc.json');
-const yargsParserConfig = require('../../package.json').yargs;
const {list} = require('./run-helpers');
const {loadConfig, findConfig} = require('./config');
-const findup = require('findup-sync');
+const findUp = require('find-up');
const {deprecate} = require('../utils');
const debug = require('debug')('mocha:cli:options');
const {createMissingArgumentError} = require('../errors');
@@ -33,6 +32,16 @@
*/
/**
+ * Base yargs parser configuration
+ * @private
+ */
+const YARGS_PARSER_CONFIG = {
+ 'combine-arrays': true,
+ 'short-option-groups': false,
+ 'dot-notation': false
+};
+
+/**
* This is the config pulled from the `yargs` property of Mocha's
* `package.json`, but it also disables camel case expansion as to
* avoid outputting non-canonical keynames, as we need to do some
@@ -40,7 +49,7 @@
* @private
* @ignore
*/
-const configuration = Object.assign({}, yargsParserConfig, {
+const configuration = Object.assign({}, YARGS_PARSER_CONFIG, {
'camel-case-expansion': false
});
@@ -246,7 +255,7 @@
return result;
}
result = {};
- const filepath = args.package || findup(mocharc.package);
+ const filepath = args.package || findUp.sync(mocharc.package);
if (filepath) {
try {
const pkg = JSON.parse(fs.readFileSync(filepath, 'utf8'));
@@ -335,3 +344,4 @@
};
module.exports.loadOptions = loadOptions;
+module.exports.YARGS_PARSER_CONFIG = YARGS_PARSER_CONFIG;

lib/mocha.js

@@ -120,12 +120,15 @@
utils.deprecate(
'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
);
+ if (options.enableTimeouts === false) {
+ this.timeout(0);
+ }
+ }
+
+ // this guard exists because Suite#timeout does not consider `undefined` to be valid input
+ if (typeof options.timeout !== 'undefined') {
+ this.timeout(options.timeout === false ? 0 : options.timeout);
}
- this.timeout(
- options.enableTimeouts === false || options.timeout === false
- ? 0
- : options.timeout
- );
if ('retries' in options) {
this.retries(options.retries);

lib/reporters/base.js

@@ -92,10 +92,10 @@
* as well as user-defined color
* schemes.
*
+ * @private
* @param {string} type
* @param {string} str
* @return {string}
- * @private
*/
var color = (exports.color = function(type, str) {
if (!exports.useColors) {
@@ -168,7 +168,8 @@
/**
* Returns a diff between 2 strings with coloured ANSI output.
*
- * The diff will be either inline or unified dependant on the value
+ * @description
+ * The diff will be either inline or unified dependent on the value
* of `Base.inlineDiff`.
*
* @param {string} actual
@@ -182,14 +183,14 @@
});
/**
- * Output the given `failures` as a list.
+ * Outputs the given `failures` as a list.
*
* @public
* @memberof Mocha.reporters.Base
* @variation 1
- * @param {Array} failures
+ * @param {Object[]} failures - Each is Test instance with corresponding
+ * Error property
*/
-
exports.list = function(failures) {
console.log();
failures.forEach(function(test, i) {
@@ -257,25 +258,26 @@
};
/**
- * Initialize a new `Base` reporter.
+ * Constructs a new `Base` reporter instance.
*
- * All other reporters generally
- * inherit from this reporter.
+ * @description
+ * All other reporters generally inherit from this reporter.
*
- * @memberof Mocha.reporters
* @public
* @class
- * @param {Runner} runner
+ * @memberof Mocha.reporters
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-
-function Base(runner) {
+function Base(runner, options) {
var failures = (this.failures = []);
if (!runner) {
throw new TypeError('Missing runner argument');
}
- this.stats = runner.stats; // assigned so Reporters keep a closer reference
+ this.options = options || {};
this.runner = runner;
+ this.stats = runner.stats; // assigned so Reporters keep a closer reference
runner.on(EVENT_TEST_PASS, function(test) {
if (test.duration > test.slow()) {
@@ -297,11 +299,10 @@
}
/**
- * Output common epilogue used by many of
- * the bundled reporters.
+ * Outputs common epilogue used by many of the bundled reporters.
*
- * @memberof Mocha.reporters.Base
* @public
+ * @memberof Mocha.reporters.Base
*/
Base.prototype.epilogue = function() {
var stats = this.stats;
@@ -338,7 +339,7 @@
};
/**
- * Pad the given `str` to `len`.
+ * Pads the given `str` to `len`.
*
* @private
* @param {string} str
@@ -351,7 +352,7 @@
}
/**
- * Returns an inline diff between 2 strings with coloured ANSI output.
+ * Returns inline diff between 2 strings with coloured ANSI output.
*
* @private
* @param {String} actual
@@ -388,7 +389,7 @@
}
/**
- * Returns a unified diff between two strings with coloured ANSI output.
+ * Returns unified diff between two strings with coloured ANSI output.
*
* @private
* @param {String} actual
@@ -431,7 +432,7 @@
}
/**
- * Return a character diff for `err`.
+ * Returns character diff for `err`.
*
* @private
* @param {String} actual
@@ -454,7 +455,7 @@
}
/**
- * Color lines for `str`, using the color `name`.
+ * Colors lines for `str`, using the color `name`.
*
* @private
* @param {string} name
@@ -476,7 +477,7 @@
var objToString = Object.prototype.toString;
/**
- * Check that a / b have the same type.
+ * Checks that a / b have the same type.
*
* @private
* @param {Object} a

lib/reporters/doc.js

@@ -21,16 +21,17 @@
exports = module.exports = Doc;
/**
- * Initialize a new `Doc` reporter.
+ * Constructs a new `Doc` reporter instance.
*
+ * @public
* @class
* @memberof Mocha.reporters
- * @extends {Base}
- * @public
- * @param {Runner} runner
+ * @extends Mocha.reporters.Base
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Doc(runner) {
- Base.call(this, runner);
+function Doc(runner, options) {
+ Base.call(this, runner, options);
var indents = 2;

lib/reporters/dot.js

@@ -22,16 +22,17 @@
exports = module.exports = Dot;
/**
- * Initialize a new `Dot` matrix test reporter.
+ * Constructs a new `Dot` reporter instance.
*
+ * @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @public
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Dot(runner) {
- Base.call(this, runner);
+function Dot(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;

lib/reporters/html.js

@@ -47,16 +47,17 @@
var playIcon = '&#x2023;';
/**
- * Initialize a new `HTML` reporter.
+ * Constructs a new `HTML` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function HTML(runner) {
- Base.call(this, runner);
+function HTML(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var stats = this.stats;

lib/reporters/json.js

@@ -21,16 +21,17 @@
exports = module.exports = JSONReporter;
/**
- * Initialize a new `JSON` reporter.
+ * Constructs a new `JSON` reporter instance.
*
* @public
* @class JSON
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function JSONReporter(runner) {
- Base.call(this, runner);
+function JSONReporter(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var tests = [];

lib/reporters/json-stream.js

@@ -24,12 +24,13 @@
*
* @public
* @class
- * @extends Mocha.reporters.Base
* @memberof Mocha.reporters
+ * @extends Mocha.reporters.Base
* @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function JSONStream(runner) {
- Base.call(this, runner);
+function JSONStream(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var total = runner.total;

lib/reporters/landing.js

@@ -42,16 +42,17 @@
Base.colors.runway = 90;
/**
- * Initialize a new `Landing` reporter.
+ * Constructs a new `Landing` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Landing(runner) {
- Base.call(this, runner);
+function Landing(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;

lib/reporters/list.js

@@ -25,16 +25,17 @@
exports = module.exports = List;
/**
- * Initialize a new `List` test reporter.
+ * Constructs a new `List` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function List(runner) {
- Base.call(this, runner);
+function List(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var n = 0;

lib/reporters/markdown.js

@@ -27,16 +27,17 @@
exports = module.exports = Markdown;
/**
- * Initialize a new `Markdown` reporter.
+ * Constructs a new `Markdown` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Markdown(runner) {
- Base.call(this, runner);
+function Markdown(runner, options) {
+ Base.call(this, runner, options);
var level = 0;
var buf = '';

lib/reporters/min.js

@@ -19,16 +19,20 @@
exports = module.exports = Min;
/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
+ * Constructs a new `Min` reporter instance.
+ *
+ * @description
+ * This minimal test reporter is best used with '--watch'.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Min(runner) {
- Base.call(this, runner);
+function Min(runner, options) {
+ Base.call(this, runner, options);
runner.on(EVENT_RUN_BEGIN, function() {
// clear screen

lib/reporters/nyan.js

@@ -22,17 +22,17 @@
exports = module.exports = NyanCat;
/**
- * Initialize a new `Dot` matrix test reporter.
+ * Constructs a new `Nyan` reporter instance.
*
- * @param {Runner} runner
* @public
* @class Nyan
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-
-function NyanCat(runner) {
- Base.call(this, runner);
+function NyanCat(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;

lib/reporters/progress.js

@@ -28,17 +28,17 @@
Base.colors.progress = 90;
/**
- * Initialize a new `Progress` bar test reporter.
+ * Constructs a new `Progress` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
- * @param {Object} options
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
function Progress(runner, options) {
- Base.call(this, runner);
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.5) | 0;

lib/reporters/spec.js

@@ -25,16 +25,17 @@
exports = module.exports = Spec;
/**
- * Initialize a new `Spec` test reporter.
+ * Constructs a new `Spec` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Spec(runner) {
- Base.call(this, runner);
+function Spec(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var indents = 0;

lib/reporters/tap.js

@@ -25,12 +25,12 @@
exports = module.exports = TAP;
/**
- * Constructs a new TAP reporter with runner instance and reporter options.
+ * Constructs a new `TAP` reporter instance.
*
* @public
* @class
- * @extends Mocha.reporters.Base
* @memberof Mocha.reporters
+ * @extends Mocha.reporters.Base
* @param {Runner} runner - Instance triggers reporter actions.
* @param {Object} [options] - runner options
*/

lib/reporters/xunit.js

@@ -34,16 +34,17 @@
exports = module.exports = XUnit;
/**
- * Initialize a new `XUnit` reporter.
+ * Constructs a new `XUnit` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
function XUnit(runner, options) {
- Base.call(this, runner);
+ Base.call(this, runner, options);
var stats = this.stats;
var tests = [];

lib/runner.js

@@ -363,14 +363,16 @@
}
self.currentRunnable = hook;
- if (name === 'beforeAll') {
+ if (name === HOOK_TYPE_BEFORE_ALL) {
hook.ctx.currentTest = hook.parent.tests[0];
- } else if (name === 'afterAll') {
+ } else if (name === HOOK_TYPE_AFTER_ALL) {
hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
} else {
hook.ctx.currentTest = self.test;
}
+ hook.allowUncaught = self.allowUncaught;
+
self.emit(constants.EVENT_HOOK_BEGIN, hook);
if (!hook.listeners('error').length) {
@@ -386,8 +388,16 @@
}
if (err) {
if (err instanceof Pending) {
+ if (name === HOOK_TYPE_AFTER_ALL) {
+ utils.deprecate(
+ 'Skipping a test within an "after all" hook is DEPRECATED and will throw an exception in a future version of Mocha. ' +
+ 'Use a return statement or other means to abort hook execution.'
+ );
+ }
if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
+ if (self.test) {
self.test.pending = true;
+ }
} else {
suite.tests.forEach(function(test) {
test.pending = true;
@@ -781,6 +791,9 @@
* @private
*/
Runner.prototype.uncaught = function(err) {
+ if (err instanceof Pending) {
+ return;
+ }
if (err) {
debug('uncaught exception %O', err);
} else {

lib/suite.js

@@ -102,6 +102,7 @@
var suite = new Suite(this.title);
debug('clone');
suite.ctx = this.ctx;
+ suite.root = this.root;
suite.timeout(this.timeout());
suite.retries(this.retries());
suite.enableTimeouts(this.enableTimeouts());
@@ -114,6 +115,7 @@
* Set or get timeout `ms` or short-hand such as "2s".
*
* @private
+ * @todo Do not attempt to set value if `ms` is undefined
* @param {number|string} ms
* @return {Suite|number} for chaining
*/

mocha.js

@@ -193,7 +193,7 @@
module.exports = global;
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./lib/mocha":14,"_process":68,"browser-stdout":41}],2:[function(require,module,exports){
+},{"./lib/mocha":14,"_process":70,"browser-stdout":41}],2:[function(require,module,exports){
(function (process,global){
'use strict';
@@ -365,7 +365,7 @@
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../../package":89,"../runner":34,"_process":68}],3:[function(require,module,exports){
+},{"../../package":91,"../runner":34,"_process":70}],3:[function(require,module,exports){
'use strict';
/**
@@ -1514,12 +1514,15 @@
utils.deprecate(
'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
);
+ if (options.enableTimeouts === false) {
+ this.timeout(0);
+ }
+ }
+
+ // this guard exists because Suite#timeout does not consider `undefined` to be valid input
+ if (typeof options.timeout !== 'undefined') {
+ this.timeout(options.timeout === false ? 0 : options.timeout);
}
- this.timeout(
- options.enableTimeouts === false || options.timeout === false
- ? 0
- : options.timeout
- );
if ('retries' in options) {
this.retries(options.retries);
@@ -2234,7 +2237,7 @@
};
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../package.json":89,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":68,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){
+},{"../package.json":91,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":70,"escape-string-regexp":49,"path":40}],15:[function(require,module,exports){
module.exports={
"diff": true,
"extension": ["js"],
@@ -2356,10 +2359,10 @@
* as well as user-defined color
* schemes.
*
+ * @private
* @param {string} type
* @param {string} str
* @return {string}
- * @private
*/
var color = (exports.color = function(type, str) {
if (!exports.useColors) {
@@ -2432,7 +2435,8 @@
/**
* Returns a diff between 2 strings with coloured ANSI output.
*
- * The diff will be either inline or unified dependant on the value
+ * @description
+ * The diff will be either inline or unified dependent on the value
* of `Base.inlineDiff`.
*
* @param {string} actual
@@ -2446,14 +2450,14 @@
});
/**
- * Output the given `failures` as a list.
+ * Outputs the given `failures` as a list.
*
* @public
* @memberof Mocha.reporters.Base
* @variation 1
- * @param {Array} failures
+ * @param {Object[]} failures - Each is Test instance with corresponding
+ * Error property
*/
-
exports.list = function(failures) {
console.log();
failures.forEach(function(test, i) {
@@ -2521,25 +2525,26 @@
};
/**
- * Initialize a new `Base` reporter.
+ * Constructs a new `Base` reporter instance.
*
- * All other reporters generally
- * inherit from this reporter.
+ * @description
+ * All other reporters generally inherit from this reporter.
*
- * @memberof Mocha.reporters
* @public
* @class
- * @param {Runner} runner
+ * @memberof Mocha.reporters
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-
-function Base(runner) {
+function Base(runner, options) {
var failures = (this.failures = []);
if (!runner) {
throw new TypeError('Missing runner argument');
}
- this.stats = runner.stats; // assigned so Reporters keep a closer reference
+ this.options = options || {};
this.runner = runner;
+ this.stats = runner.stats; // assigned so Reporters keep a closer reference
runner.on(EVENT_TEST_PASS, function(test) {
if (test.duration > test.slow()) {
@@ -2561,11 +2566,10 @@
}
/**
- * Output common epilogue used by many of
- * the bundled reporters.
+ * Outputs common epilogue used by many of the bundled reporters.
*
- * @memberof Mocha.reporters.Base
* @public
+ * @memberof Mocha.reporters.Base
*/
Base.prototype.epilogue = function() {
var stats = this.stats;
@@ -2602,7 +2606,7 @@
};
/**
- * Pad the given `str` to `len`.
+ * Pads the given `str` to `len`.
*
* @private
* @param {string} str
@@ -2615,7 +2619,7 @@
}
/**
- * Returns an inline diff between 2 strings with coloured ANSI output.
+ * Returns inline diff between 2 strings with coloured ANSI output.
*
* @private
* @param {String} actual
@@ -2652,7 +2656,7 @@
}
/**
- * Returns a unified diff between two strings with coloured ANSI output.
+ * Returns unified diff between two strings with coloured ANSI output.
*
* @private
* @param {String} actual
@@ -2695,7 +2699,7 @@
}
/**
- * Return a character diff for `err`.
+ * Returns character diff for `err`.
*
* @private
* @param {String} actual
@@ -2718,7 +2722,7 @@
}
/**
- * Color lines for `str`, using the color `name`.
+ * Colors lines for `str`, using the color `name`.
*
* @private
* @param {string} name
@@ -2740,7 +2744,7 @@
var objToString = Object.prototype.toString;
/**
- * Check that a / b have the same type.
+ * Checks that a / b have the same type.
*
* @private
* @param {Object} a
@@ -2754,7 +2758,7 @@
Base.abstract = true;
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"_process":68,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"_process":70,"diff":48,"ms":60,"supports-color":40,"tty":4}],18:[function(require,module,exports){
'use strict';
/**
* @module Doc
@@ -2778,16 +2782,17 @@
exports = module.exports = Doc;
/**
- * Initialize a new `Doc` reporter.
+ * Constructs a new `Doc` reporter instance.
*
+ * @public
* @class
* @memberof Mocha.reporters
- * @extends {Base}
- * @public
- * @param {Runner} runner
+ * @extends Mocha.reporters.Base
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Doc(runner) {
- Base.call(this, runner);
+function Doc(runner, options) {
+ Base.call(this, runner, options);
var indents = 2;
@@ -2866,16 +2871,17 @@
exports = module.exports = Dot;
/**
- * Initialize a new `Dot` matrix test reporter.
+ * Constructs a new `Dot` reporter instance.
*
+ * @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @public
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Dot(runner) {
- Base.call(this, runner);
+function Dot(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;
@@ -2924,7 +2930,7 @@
Dot.description = 'dot matrix representation';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],20:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],20:[function(require,module,exports){
(function (global){
'use strict';
@@ -2975,16 +2981,17 @@
var playIcon = '&#x2023;';
/**
- * Initialize a new `HTML` reporter.
+ * Constructs a new `HTML` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function HTML(runner) {
- Base.call(this, runner);
+function HTML(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var stats = this.stats;
@@ -3366,12 +3373,13 @@
*
* @public
* @class
- * @extends Mocha.reporters.Base
* @memberof Mocha.reporters
+ * @extends Mocha.reporters.Base
* @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function JSONStream(runner) {
- Base.call(this, runner);
+function JSONStream(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var total = runner.total;
@@ -3431,7 +3439,7 @@
JSONStream.description = 'newline delimited JSON events';
}).call(this,require('_process'))
-},{"../runner":34,"./base":17,"_process":68}],23:[function(require,module,exports){
+},{"../runner":34,"./base":17,"_process":70}],23:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3456,16 +3464,17 @@
exports = module.exports = JSONReporter;
/**
- * Initialize a new `JSON` reporter.
+ * Constructs a new `JSON` reporter instance.
*
* @public
* @class JSON
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function JSONReporter(runner) {
- Base.call(this, runner);
+function JSONReporter(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var tests = [];
@@ -3569,7 +3578,7 @@
JSONReporter.description = 'single JSON object';
}).call(this,require('_process'))
-},{"../runner":34,"./base":17,"_process":68}],24:[function(require,module,exports){
+},{"../runner":34,"./base":17,"_process":70}],24:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3615,16 +3624,17 @@
Base.colors.runway = 90;
/**
- * Initialize a new `Landing` reporter.
+ * Constructs a new `Landing` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Landing(runner) {
- Base.call(this, runner);
+function Landing(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;
@@ -3680,7 +3690,7 @@
Landing.description = 'Unicode landing strip';
}).call(this,require('_process'))
-},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":68}],25:[function(require,module,exports){
+},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":70}],25:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3709,16 +3719,17 @@
exports = module.exports = List;
/**
- * Initialize a new `List` test reporter.
+ * Constructs a new `List` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function List(runner) {
- Base.call(this, runner);
+function List(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var n = 0;
@@ -3761,7 +3772,7 @@
List.description = 'like "spec" reporter but flat';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],26:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],26:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3792,16 +3803,17 @@
exports = module.exports = Markdown;
/**
- * Initialize a new `Markdown` reporter.
+ * Constructs a new `Markdown` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Markdown(runner) {
- Base.call(this, runner);
+function Markdown(runner, options) {
+ Base.call(this, runner, options);
var level = 0;
var buf = '';
@@ -3876,7 +3888,7 @@
Markdown.description = 'GitHub Flavored Markdown';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],27:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],27:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3899,16 +3911,20 @@
exports = module.exports = Min;
/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
+ * Constructs a new `Min` reporter instance.
+ *
+ * @description
+ * This minimal test reporter is best used with '--watch'.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Min(runner) {
- Base.call(this, runner);
+function Min(runner, options) {
+ Base.call(this, runner, options);
runner.on(EVENT_RUN_BEGIN, function() {
// clear screen
@@ -3928,7 +3944,7 @@
Min.description = 'essentially just a summary';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],28:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],28:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -3954,17 +3970,17 @@
exports = module.exports = NyanCat;
/**
- * Initialize a new `Dot` matrix test reporter.
+ * Constructs a new `Nyan` reporter instance.
*
- * @param {Runner} runner
* @public
* @class Nyan
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-
-function NyanCat(runner) {
- Base.call(this, runner);
+function NyanCat(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;
@@ -4208,7 +4224,7 @@
NyanCat.description = '"nyan cat"';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],29:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],29:[function(require,module,exports){
(function (process){
'use strict';
/**
@@ -4240,17 +4256,17 @@
Base.colors.progress = 90;
/**
- * Initialize a new `Progress` bar test reporter.
+ * Constructs a new `Progress` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
- * @param {Object} options
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
function Progress(runner, options) {
- Base.call(this, runner);
+ Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.5) | 0;
@@ -4316,7 +4332,7 @@
Progress.description = 'a progress bar';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68}],30:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70}],30:[function(require,module,exports){
'use strict';
/**
* @module Spec
@@ -4344,16 +4360,17 @@
exports = module.exports = Spec;
/**
- * Initialize a new `Spec` test reporter.
+ * Constructs a new `Spec` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
-function Spec(runner) {
- Base.call(this, runner);
+function Spec(runner, options) {
+ Base.call(this, runner, options);
var self = this;
var indents = 0;
@@ -4445,12 +4462,12 @@
exports = module.exports = TAP;
/**
- * Constructs a new TAP reporter with runner instance and reporter options.
+ * Constructs a new `TAP` reporter instance.
*
* @public
* @class
- * @extends Mocha.reporters.Base
* @memberof Mocha.reporters
+ * @extends Mocha.reporters.Base
* @param {Runner} runner - Instance triggers reporter actions.
* @param {Object} [options] - runner options
*/
@@ -4714,7 +4731,7 @@
TAP.description = 'TAP-compatible output';
}).call(this,require('_process'))
-},{"../runner":34,"../utils":38,"./base":17,"_process":68,"util":88}],32:[function(require,module,exports){
+},{"../runner":34,"../utils":38,"./base":17,"_process":70,"util":90}],32:[function(require,module,exports){
(function (process,global){
'use strict';
/**
@@ -4752,16 +4769,17 @@
exports = module.exports = XUnit;
/**
- * Initialize a new `XUnit` reporter.
+ * Constructs a new `XUnit` reporter instance.
*
* @public
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
- * @param {Runner} runner
+ * @param {Runner} runner - Instance triggers reporter actions.
+ * @param {Object} [options] - runner options
*/
function XUnit(runner, options) {
- Base.call(this, runner);
+ Base.call(this, runner, options);
var stats = this.stats;
var tests = [];
@@ -4933,7 +4951,7 @@
XUnit.description = 'XUnit-compatible XML output';
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":68,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
+},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":70,"fs":40,"mkdirp":59,"path":40}],33:[function(require,module,exports){
(function (global){
'use strict';
@@ -5800,14 +5818,16 @@
}
self.currentRunnable = hook;
- if (name === 'beforeAll') {
+ if (name === HOOK_TYPE_BEFORE_ALL) {
hook.ctx.currentTest = hook.parent.tests[0];
- } else if (name === 'afterAll') {
+ } else if (name === HOOK_TYPE_AFTER_ALL) {
hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
} else {
hook.ctx.currentTest = self.test;
}
+ hook.allowUncaught = self.allowUncaught;
+
self.emit(constants.EVENT_HOOK_BEGIN, hook);
if (!hook.listeners('error').length) {
@@ -5823,8 +5843,16 @@
}
if (err) {
if (err instanceof Pending) {
+ if (name === HOOK_TYPE_AFTER_ALL) {
+ utils.deprecate(
+ 'Skipping a test within an "after all" hook is DEPRECATED and will throw an exception in a future version of Mocha. ' +
+ 'Use a return statement or other means to abort hook execution.'
+ );
+ }
if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
+ if (self.test) {
self.test.pending = true;
+ }
} else {
suite.tests.forEach(function(test) {
test.pending = true;
@@ -6218,6 +6246,9 @@
* @private
*/
Runner.prototype.uncaught = function(err) {
+ if (err instanceof Pending) {
+ return;
+ }
if (err) {
debug('uncaught exception %O', err);
} else {
@@ -6473,7 +6504,7 @@
*/
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":68,"debug":45,"events":50,"util":88}],35:[function(require,module,exports){
+},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":70,"debug":45,"events":50,"util":90}],35:[function(require,module,exports){
(function (global){
'use strict';
@@ -6665,6 +6696,7 @@
var suite = new Suite(this.title);
debug('clone');
suite.ctx = this.ctx;
+ suite.root = this.root;
suite.timeout(this.timeout());
suite.retries(this.retries());
suite.enableTimeouts(this.enableTimeouts());
@@ -6677,6 +6709,7 @@
* Set or get timeout `ms` or short-hand such as "2s".
*
* @private
+ * @todo Do not attempt to set value if `ms` is undefined
* @param {number|string} ms
* @return {Suite|number} for chaining
*/
@@ -8156,7 +8189,7 @@
};
}).call(this,require('_process'),require("buffer").Buffer)
-},{"./errors":6,"_process":68,"buffer":43,"debug":45,"fs":42,"glob":42,"he":54,"object.assign":64,"path":42,"util":88}],39:[function(require,module,exports){
+},{"./errors":6,"_process":70,"buffer":43,"debug":45,"fs":40,"glob":40,"he":54,"object.assign":65,"path":40,"util":90}],39:[function(require,module,exports){
'use strict'
exports.byteLength = byteLength
@@ -8340,9 +8373,10 @@
}
}).call(this,require('_process'))
-},{"_process":68,"stream":83,"util":88}],42:[function(require,module,exports){
+},{"_process":70,"stream":85,"util":90}],42:[function(require,module,exports){
arguments[4][40][0].apply(exports,arguments)
},{"dup":40}],43:[function(require,module,exports){
+(function (Buffer){
/*!
* The buffer module from node.js, for the browser.
*
@@ -8391,7 +8425,7 @@
// Can typed array instances can be augmented?
try {
var arr = new Uint8Array(1)
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
+ arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
return arr.foo() === 42
} catch (e) {
return false
@@ -8399,26 +8433,24 @@
}
Object.defineProperty(Buffer.prototype, 'parent', {
+ enumerable: true,
get: function () {
- if (!(this instanceof Buffer)) {
- return undefined
- }
+ if (!Buffer.isBuffer(this)) return undefined
return this.buffer
}
})
Object.defineProperty(Buffer.prototype, 'offset', {
+ enumerable: true,
get: function () {
- if (!(this instanceof Buffer)) {
- return undefined
- }
+ if (!Buffer.isBuffer(this)) return undefined
return this.byteOffset
}
})
function createBuffer (length) {
if (length > K_MAX_LENGTH) {
- throw new RangeError('Invalid typed array length')
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
}
// Return an augmented `Uint8Array` instance
var buf = new Uint8Array(length)
@@ -8440,8 +8472,8 @@
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
- throw new Error(
- 'If encoding is specified then the first argument must be a string'
+ throw new TypeError(
+ 'The "string" argument must be of type string. Received type number'
)
}
return allocUnsafe(arg)
@@ -8450,7 +8482,7 @@
}
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
-if (typeof Symbol !== 'undefined' && Symbol.species &&
+if (typeof Symbol !== 'undefined' && Symbol.species != null &&
Buffer[Symbol.species] === Buffer) {
Object.defineProperty(Buffer, Symbol.species, {
value: null,
@@ -8463,19 +8495,51 @@
Buffer.poolSize = 8192 // not used by this implementation
function from (value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number')
+ if (typeof value === 'string') {
+ return fromString(value, encodingOrOffset)
+ }
+
+ if (ArrayBuffer.isView(value)) {
+ return fromArrayLike(value)
+ }
+
+ if (value == null) {
+ throw TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
}
- if (isArrayBuffer(value) || (value && isArrayBuffer(value.buffer))) {
+ if (isInstance(value, ArrayBuffer) ||
+ (value && isInstance(value.buffer, ArrayBuffer))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
- if (typeof value === 'string') {
- return fromString(value, encodingOrOffset)
+ if (typeof value === 'number') {
+ throw new TypeError(
+ 'The "value" argument must not be of type number. Received type number'
+ )
+ }
+
+ var valueOf = value.valueOf && value.valueOf()
+ if (valueOf != null && valueOf !== value) {
+ return Buffer.from(valueOf, encodingOrOffset, length)
}
- return fromObject(value)
+ var b = fromObject(value)
+ if (b) return b
+
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
+ typeof value[Symbol.toPrimitive] === 'function') {
+ return Buffer.from(
+ value[Symbol.toPrimitive]('string'), encodingOrOffset, length
+ )
+ }
+
+ throw new TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
}
/**
@@ -8499,7 +8563,7 @@
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be of type number')
} else if (size < 0) {
- throw new RangeError('"size" argument must not be negative')
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
}
@@ -8614,8 +8678,7 @@
return buf
}
- if (obj) {
- if (ArrayBuffer.isView(obj) || 'length' in obj) {
+ if (obj.length !== undefined) {
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
return createBuffer(0)
}
@@ -8625,9 +8688,6 @@
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data)
}
- }
-
- throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.')
}
function checked (length) {
@@ -8648,12 +8708,17 @@
}
Buffer.isBuffer = function isBuffer (b) {
- return b != null && b._isBuffer === true
+ return b != null && b._isBuffer === true &&
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
}
Buffer.compare = function compare (a, b) {
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('Arguments must be Buffers')
+ throw new TypeError(
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
+ )
}
if (a === b) return 0
@@ -8714,7 +8779,7 @@
var pos = 0
for (i = 0; i < list.length; ++i) {
var buf = list[i]
- if (ArrayBuffer.isView(buf)) {
+ if (isInstance(buf, Uint8Array)) {
buf = Buffer.from(buf)
}
if (!Buffer.isBuffer(buf)) {
@@ -8730,15 +8795,19 @@
if (Buffer.isBuffer(string)) {
return string.length
}
- if (ArrayBuffer.isView(string) || isArrayBuffer(string)) {
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
- string = '' + string
+ throw new TypeError(
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
+ 'Received type ' + typeof string
+ )
}
var len = string.length
- if (len === 0) return 0
+ var mustMatch = (arguments.length > 2 && arguments[2] === true)
+ if (!mustMatch && len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
@@ -8750,7 +8819,6 @@
return len
case 'utf8':
case 'utf-8':
- case undefined:
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
@@ -8762,7 +8830,9 @@
case 'base64':
return base64ToBytes(string).length
default:
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
+ if (loweredCase) {
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
+ }
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
@@ -8909,16 +8979,20 @@
Buffer.prototype.inspect = function inspect () {
var str = ''
var max = exports.INSPECT_MAX_BYTES
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
if (this.length > max) str += ' ... '
- }
return '<Buffer ' + str + '>'
}
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
+ if (isInstance(target, Uint8Array)) {
+ target = Buffer.from(target, target.offset, target.byteLength)
+ }
if (!Buffer.isBuffer(target)) {
- throw new TypeError('Argument must be a Buffer')
+ throw new TypeError(
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
+ 'Received type ' + (typeof target)
+ )
}
if (start === undefined) {
@@ -9913,7 +9987,7 @@
} else {
var bytes = Buffer.isBuffer(val)
? val
- : new Buffer(val, encoding)
+ : Buffer.from(val, encoding)
var len = bytes.length
if (len === 0) {
throw new TypeError('The value "' + val +
@@ -10068,19 +10142,21 @@
return i
}
-// ArrayBuffers from another context (i.e. an iframe) do not pass the `instanceof` check
-// but they should be treated as valid. See: https://github.com/feross/buffer/issues/166
-function isArrayBuffer (obj) {
- return obj instanceof ArrayBuffer ||
- (obj != null && obj.constructor != null && obj.constructor.name === 'ArrayBuffer' &&
- typeof obj.byteLength === 'number')
+// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
+// the `instanceof` check but they should be treated as of that type.
+// See: https://github.com/feross/buffer/issues/166
+function isInstance (obj, type) {
+ return obj instanceof type ||
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
+ obj.constructor.name === type.name)
}
-
function numberIsNaN (obj) {
+ // For IE11 support
return obj !== obj // eslint-disable-line no-self-compare
}
-},{"base64-js":39,"ieee754":55}],44:[function(require,module,exports){
+}).call(this,require("buffer").Buffer)
+},{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
(function (Buffer){
// Copyright Joyent, Inc. and other Node contributors.
//
@@ -10375,7 +10451,7 @@
}).call(this,require('_process'))
-},{"./common":46,"_process":68}],46:[function(require,module,exports){
+},{"./common":46,"_process":70}],46:[function(require,module,exports){
"use strict";
/**
@@ -10686,7 +10762,7 @@
module.exports = defineProperties;
-},{"object-keys":61}],48:[function(require,module,exports){
+},{"object-keys":62}],48:[function(require,module,exports){
/*!
diff v3.5.0
@@ -13763,7 +13839,7 @@
};
}).call(this,require('_process'))
-},{"_process":68,"fs":42,"path":42}],60:[function(require,module,exports){
+},{"_process":70,"fs":42,"path":68}],60:[function(require,module,exports){
/**
* Helpers.
*/
@@ -13930,15 +14006,16 @@
},{}],61:[function(require,module,exports){
'use strict';
-// modified from https://github.com/es-shims/es5-shim
-var has = Object.prototype.hasOwnProperty;
-var toStr = Object.prototype.toString;
-var slice = Array.prototype.slice;
-var isArgs = require('./isArguments');
-var isEnumerable = Object.prototype.propertyIsEnumerable;
-var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
-var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
-var dontEnums = [
+var keysShim;
+if (!Object.keys) {
+ // modified from https://github.com/es-shims/es5-shim
+ var has = Object.prototype.hasOwnProperty;
+ var toStr = Object.prototype.toString;
+ var isArgs = require('./isArguments'); // eslint-disable-line global-require
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
+ var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
+ var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
+ var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
@@ -13946,12 +14023,12 @@
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
-];
-var equalsConstructorPrototype = function (o) {
+ ];
+ var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
-};
-var excludedKeys = {
+ };
+ var excludedKeys = {
$applicationCache: true,
$console: true,
$external: true,
@@ -13973,8 +14050,8 @@
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
-};
-var hasAutomationEqualityBug = (function () {
+ };
+ var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
@@ -13991,8 +14068,8 @@
}
}
return false;
-}());
-var equalsConstructorPrototypeIfNotBuggy = function (o) {
+ }());
+ var equalsConstructorPrototypeIfNotBuggy = function (o) {
/* global window */
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
return equalsConstructorPrototype(o);
@@ -14002,9 +14079,9 @@
} catch (e) {
return false;
}
-};
+ };
-var keysShim = function keys(object) {
+ keysShim = function keys(object) {
var isObject = object !== null && typeof object === 'object';
var isFunction = toStr.call(object) === '[object Function]';
var isArguments = isArgs(object);
@@ -14044,22 +14121,34 @@
}
}
return theKeys;
-};
+ };
+}
+module.exports = keysShim;
+
+},{"./isArguments":63}],62:[function(require,module,exports){
+'use strict';
+
+var slice = Array.prototype.slice;
+var isArgs = require('./isArguments');
+
+var origKeys = Object.keys;
+var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
+
+var originalKeys = Object.keys;
keysShim.shim = function shimObjectKeys() {
if (Object.keys) {
var keysWorksWithArguments = (function () {
// Safari 5.0 bug
- return (Object.keys(arguments) || '').length === 2;
+ var args = Object.keys(arguments);
+ return args && args.length === arguments.length;
}(1, 2));
if (!keysWorksWithArguments) {
- var originalKeys = Object.keys;
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
if (isArgs(object)) {
return originalKeys(slice.call(object));
- } else {
- return originalKeys(object);
}
+ return originalKeys(object);
};
}
} else {
@@ -14070,7 +14159,7 @@
module.exports = keysShim;
-},{"./isArguments":62}],62:[function(require,module,exports){
+},{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
'use strict';
var toStr = Object.prototype.toString;
@@ -14089,7 +14178,7 @@
return isArgs;
};
-},{}],63:[function(require,module,exports){
+},{}],64:[function(require,module,exports){
'use strict';
// modified from https://github.com/es-shims/es6-shim
@@ -14132,7 +14221,7 @@
return objTarget;
};
-},{"function-bind":52,"has-symbols/shams":53,"object-keys":61}],64:[function(require,module,exports){
+},{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
'use strict';
var defineProperties = require('define-properties');
@@ -14151,7 +14240,7 @@
module.exports = polyfill;
-},{"./implementation":63,"./polyfill":65,"./shim":66,"define-properties":47}],65:[function(require,module,exports){
+},{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
'use strict';
var implementation = require('./implementation');
@@ -14204,7 +14293,7 @@
return Object.assign;
};
-},{"./implementation":63}],66:[function(require,module,exports){
+},{"./implementation":64}],67:[function(require,module,exports){
'use strict';
var define = require('define-properties');
@@ -14220,7 +14309,313 @@
return polyfill;
};
-},{"./polyfill":65,"define-properties":47}],67:[function(require,module,exports){
+},{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
+(function (process){
+// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
+// backported and transplited with Babel, with backwards-compat fixes
+
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length - 1; i >= 0; i--) {
+ var last = parts[i];
+ if (last === '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+ var resolvedPath = '',
+ resolvedAbsolute = false;
+
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0) ? arguments[i] : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if (!path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+ }
+
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when process.cwd() fails)
+
+ // Normalize the path
+ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+ var isAbsolute = exports.isAbsolute(path),
+ trailingSlash = substr(path, -1) === '/';
+
+ // Normalize the path
+ path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+// posix version
+exports.isAbsolute = function(path) {
+ return path.charAt(0) === '/';
+};
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ if (typeof p !== 'string') {
+ throw new TypeError('Arguments to path.join must be strings');
+ }
+ return p;
+ }).join('/'));
+};
+
+
+// path.relative(from, to)
+// posix version
+exports.relative = function(from, to) {
+ from = exports.resolve(from).substr(1);
+ to = exports.resolve(to).substr(1);
+
+ function trim(arr) {
+ var start = 0;
+ for (; start < arr.length; start++) {
+ if (arr[start] !== '') break;
+ }
+
+ var end = arr.length - 1;
+ for (; end >= 0; end--) {
+ if (arr[end] !== '') break;
+ }
+
+ if (start > end) return [];
+ return arr.slice(start, end - start + 1);
+ }
+
+ var fromParts = trim(from.split('/'));
+ var toParts = trim(to.split('/'));
+
+ var length = Math.min(fromParts.length, toParts.length);
+ var samePartsLength = length;
+ for (var i = 0; i < length; i++) {
+ if (fromParts[i] !== toParts[i]) {
+ samePartsLength = i;
+ break;
+ }
+ }
+
+ var outputParts = [];
+ for (var i = samePartsLength; i < fromParts.length; i++) {
+ outputParts.push('..');
+ }
+
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
+
+ return outputParts.join('/');
+};
+
+exports.sep = '/';
+exports.delimiter = ':';
+
+exports.dirname = function (path) {
+ if (typeof path !== 'string') path = path + '';
+ if (path.length === 0) return '.';
+ var code = path.charCodeAt(0);
+ var hasRoot = code === 47 /*/*/;
+ var end = -1;
+ var matchedSlash = true;
+ for (var i = path.length - 1; i >= 1; --i) {
+ code = path.charCodeAt(i);
+ if (code === 47 /*/*/) {
+ if (!matchedSlash) {
+ end = i;
+ break;
+ }
+ } else {
+ // We saw the first non-path separator
+ matchedSlash = false;
+ }
+ }
+
+ if (end === -1) return hasRoot ? '/' : '.';
+ if (hasRoot && end === 1) {
+ // return '//';
+ // Backwards-compat fix:
+ return '/';
+ }
+ return path.slice(0, end);
+};
+
+function basename(path) {
+ if (typeof path !== 'string') path = path + '';
+
+ var start = 0;
+ var end = -1;
+ var matchedSlash = true;
+ var i;
+
+ for (i = path.length - 1; i >= 0; --i) {
+ if (path.charCodeAt(i) === 47 /*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ start = i + 1;
+ break;
+ }
+ } else if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // path component
+ matchedSlash = false;
+ end = i + 1;
+ }
+ }
+
+ if (end === -1) return '';
+ return path.slice(start, end);
+}
+
+// Uses a mixed approach for backwards-compatibility, as ext behavior changed
+// in new Node.js versions, so only basename() above is backported here
+exports.basename = function (path, ext) {
+ var f = basename(path);
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+exports.extname = function (path) {
+ if (typeof path !== 'string') path = path + '';
+ var startDot = -1;
+ var startPart = 0;
+ var end = -1;
+ var matchedSlash = true;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ var preDotState = 0;
+ for (var i = path.length - 1; i >= 0; --i) {
+ var code = path.charCodeAt(i);
+ if (code === 47 /*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === 46 /*.*/) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1)
+ startDot = i;
+ else if (preDotState !== 1)
+ preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+
+ if (startDot === -1 || end === -1 ||
+ // We saw a non-dot character immediately before the dot
+ preDotState === 0 ||
+ // The (right-most) trimmed path component is exactly '..'
+ preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
+ return '';
+ }
+ return path.slice(startDot, end);
+};
+
+function filter (xs, f) {
+ if (xs.filter) return xs.filter(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (f(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// String.prototype.substr - negative index don't work in IE8
+var substr = 'ab'.substr(-1) === 'b'
+ ? function (str, start, len) { return str.substr(start, len) }
+ : function (str, start, len) {
+ if (start < 0) start = str.length + start;
+ return str.substr(start, len);
+ }
+;
+
+}).call(this,require('_process'))
+},{"_process":70}],69:[function(require,module,exports){
(function (process){
'use strict';
@@ -14268,7 +14663,7 @@
}).call(this,require('_process'))
-},{"_process":68}],68:[function(require,module,exports){
+},{"_process":70}],70:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -14454,10 +14849,10 @@
};
process.umask = function() { return 0; };
-},{}],69:[function(require,module,exports){
+},{}],71:[function(require,module,exports){
module.exports = require('./lib/_stream_duplex.js');
-},{"./lib/_stream_duplex.js":70}],70:[function(require,module,exports){
+},{"./lib/_stream_duplex.js":72}],72:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -14589,7 +14984,7 @@
pna.nextTick(cb, err);
};
-},{"./_stream_readable":72,"./_stream_writable":74,"core-util-is":44,"inherits":56,"process-nextick-args":67}],71:[function(require,module,exports){
+},{"./_stream_readable":74,"./_stream_writable":76,"core-util-is":44,"inherits":56,"process-nextick-args":69}],73:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -14637,7 +15032,7 @@
PassThrough.prototype._transform = function (chunk, encoding, cb) {
cb(null, chunk);
};
-},{"./_stream_transform":73,"core-util-is":44,"inherits":56}],72:[function(require,module,exports){
+},{"./_stream_transform":75,"core-util-is":44,"inherits":56}],74:[function(require,module,exports){
(function (process,global){
// Copyright Joyent, Inc. and other Node contributors.
//
@@ -15659,7 +16054,7 @@
return -1;
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./_stream_duplex":70,"./internal/streams/BufferList":75,"./internal/streams/destroy":76,"./internal/streams/stream":77,"_process":68,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":67,"safe-buffer":82,"string_decoder/":84,"util":40}],73:[function(require,module,exports){
+},{"./_stream_duplex":72,"./internal/streams/BufferList":77,"./internal/streams/destroy":78,"./internal/streams/stream":79,"_process":70,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":69,"safe-buffer":84,"string_decoder/":86,"util":40}],75:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -15874,8 +16269,8 @@
return stream.push(null);
}
-},{"./_stream_duplex":70,"core-util-is":44,"inherits":56}],74:[function(require,module,exports){
-(function (process,global){
+},{"./_stream_duplex":72,"core-util-is":44,"inherits":56}],76:[function(require,module,exports){
+(function (process,global,setImmediate){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -16563,8 +16958,8 @@
this.end();
cb(err);
};
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./_stream_duplex":70,"./internal/streams/destroy":76,"./internal/streams/stream":77,"_process":68,"core-util-is":44,"inherits":56,"process-nextick-args":67,"safe-buffer":82,"util-deprecate":85}],75:[function(require,module,exports){
+}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
+},{"./_stream_duplex":72,"./internal/streams/destroy":78,"./internal/streams/stream":79,"_process":70,"core-util-is":44,"inherits":56,"process-nextick-args":69,"safe-buffer":84,"timers":87,"util-deprecate":88}],77:[function(require,module,exports){
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -16644,7 +17039,7 @@
return this.constructor.name + ' ' + obj;
};
}
-},{"safe-buffer":82,"util":40}],76:[function(require,module,exports){
+},{"safe-buffer":84,"util":40}],78:[function(require,module,exports){
'use strict';
/*<replacement>*/
@@ -16719,13 +17114,13 @@
destroy: destroy,
undestroy: undestroy
};
-},{"process-nextick-args":67}],77:[function(require,module,exports){
+},{"process-nextick-args":69}],79:[function(require,module,exports){
module.exports = require('events').EventEmitter;
-},{"events":50}],78:[function(require,module,exports){
+},{"events":50}],80:[function(require,module,exports){
module.exports = require('./readable').PassThrough
-},{"./readable":79}],79:[function(require,module,exports){
+},{"./readable":81}],81:[function(require,module,exports){
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = exports;
exports.Readable = exports;
@@ -16734,13 +17129,13 @@
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
-},{"./lib/_stream_duplex.js":70,"./lib/_stream_passthrough.js":71,"./lib/_stream_readable.js":72,"./lib/_stream_transform.js":73,"./lib/_stream_writable.js":74}],80:[function(require,module,exports){
+},{"./lib/_stream_duplex.js":72,"./lib/_stream_passthrough.js":73,"./lib/_stream_readable.js":74,"./lib/_stream_transform.js":75,"./lib/_stream_writable.js":76}],82:[function(require,module,exports){
module.exports = require('./readable').Transform
-},{"./readable":79}],81:[function(require,module,exports){
+},{"./readable":81}],83:[function(require,module,exports){
module.exports = require('./lib/_stream_writable.js');
-},{"./lib/_stream_writable.js":74}],82:[function(require,module,exports){
+},{"./lib/_stream_writable.js":76}],84:[function(require,module,exports){
/* eslint-disable node/no-deprecated-api */
var buffer = require('buffer')
var Buffer = buffer.Buffer
@@ -16804,7 +17199,7 @@
return buffer.SlowBuffer(size)
}
-},{"buffer":43}],83:[function(require,module,exports){
+},{"buffer":43}],85:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -16933,7 +17328,7 @@
return dest;
};
-},{"events":50,"inherits":56,"readable-stream/duplex.js":69,"readable-stream/passthrough.js":78,"readable-stream/readable.js":79,"readable-stream/transform.js":80,"readable-stream/writable.js":81}],84:[function(require,module,exports){
+},{"events":50,"inherits":56,"readable-stream/duplex.js":71,"readable-stream/passthrough.js":80,"readable-stream/readable.js":81,"readable-stream/transform.js":82,"readable-stream/writable.js":83}],86:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -17230,7 +17625,86 @@
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : '';
}
-},{"safe-buffer":82}],85:[function(require,module,exports){
+},{"safe-buffer":84}],87:[function(require,module,exports){
+(function (setImmediate,clearImmediate){
+var nextTick = require('process/browser.js').nextTick;
+var apply = Function.prototype.apply;
+var slice = Array.prototype.slice;
+var immediateIds = {};
+var nextImmediateId = 0;
+
+// DOM APIs, for completeness
+
+exports.setTimeout = function() {
+ return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+};
+exports.setInterval = function() {
+ return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+};
+exports.clearTimeout =
+exports.clearInterval = function(timeout) { timeout.close(); };
+
+function Timeout(id, clearFn) {
+ this._id = id;
+ this._clearFn = clearFn;
+}
+Timeout.prototype.unref = Timeout.prototype.ref = function() {};
+Timeout.prototype.close = function() {
+ this._clearFn.call(window, this._id);
+};
+
+// Does not start the time, just sets up the members needed.
+exports.enroll = function(item, msecs) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = msecs;
+};
+
+exports.unenroll = function(item) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = -1;
+};
+
+exports._unrefActive = exports.active = function(item) {
+ clearTimeout(item._idleTimeoutId);
+
+ var msecs = item._idleTimeout;
+ if (msecs >= 0) {
+ item._idleTimeoutId = setTimeout(function onTimeout() {
+ if (item._onTimeout)
+ item._onTimeout();
+ }, msecs);
+ }
+};
+
+// That's not how node.js implements it but the exposed api is the same.
+exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
+ var id = nextImmediateId++;
+ var args = arguments.length < 2 ? false : slice.call(arguments, 1);
+
+ immediateIds[id] = true;
+
+ nextTick(function onNextTick() {
+ if (immediateIds[id]) {
+ // fn.call() is faster so we optimize for the common use-case
+ // @see http://jsperf.com/call-apply-segu
+ if (args) {
+ fn.apply(null, args);
+ } else {
+ fn.call(null);
+ }
+ // Prevent ids from leaking
+ exports.clearImmediate(id);
+ }
+ });
+
+ return id;
+};
+
+exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
+ delete immediateIds[id];
+};
+}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
+},{"process/browser.js":70,"timers":87}],88:[function(require,module,exports){
(function (global){
/**
@@ -17301,16 +17775,14 @@
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],86:[function(require,module,exports){
-arguments[4][56][0].apply(exports,arguments)
-},{"dup":56}],87:[function(require,module,exports){
+},{}],89:[function(require,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
-},{}],88:[function(require,module,exports){
+},{}],90:[function(require,module,exports){
(function (process,global){
// Copyright Joyent, Inc. and other Node contributors.
//
@@ -17900,10 +18372,10 @@
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":87,"_process":68,"inherits":86}],89:[function(require,module,exports){
+},{"./support/isBuffer":89,"_process":70,"inherits":56}],91:[function(require,module,exports){
module.exports={
"name": "mocha",
- "version": "6.0.2",
+ "version": "6.1.1",
"homepage": "https://mochajs.org/",
"notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
}

package.json

@@ -1,6 +1,6 @@
{
"name": "mocha",
- "version": "6.0.2",
+ "version": "6.1.1",
"description": "simple, flexible, fun test framework",
"keywords": [
"mocha",
@@ -19,6 +19,7 @@
"Aaron Petcoff <hello@aaronpetcoff.me>",
"abrkn <a@abrkn.com>",
"Adam Crabtree <adam.crabtree@redrobotlabs.com>",
+ "Adam Ginzberg <aginzberg@gmail.com>",
"Adam Gruber <talknmime@gmail.com>",
"Adrian Ludwig <me@adrianludwig.pl>",
"Ahmad Bamieh <ahmadbamieh@gmail.com>",
@@ -34,6 +35,8 @@
"Andreas Brekken <andreas@opuno.com>",
"Andreas Lind <andreaslindpetersen@gmail.com>",
"Andreas Lind Petersen <andreas@one.com>",
+ "Andrew Bradley <abradley@brightcove.com>",
+ "Andrew Bradley <cspotcode@gmail.com>",
"Andrew Krawchyk <903716+akrawchyk@users.noreply.github.com>",
"Andrew Nesbitt <andrewnez@gmail.com>",
"Andrey Popp <8mayday@gmail.com>",
@@ -85,6 +88,7 @@
"Callum Macrae <callum@macr.ae>",
"Can Oztokmak <can@zeplin.io>",
"Capacitor Set <CapacitorSet@users.noreply.github.com>",
+ "Carl-Erik Kopseng <carlerik@gmail.com>",
"Casey Foster <casey@caseywebdev.com>",
"Charles Lowell <cowboyd@frontside.io>",
"Charles Merriam <charles.merriam@gmail.com>",
@@ -115,6 +119,7 @@
"David Henderson <david.henderson@triggeredmessaging.com>",
"David M. Lee <leedm777@yahoo.com>",
"David Neubauer <davidneub@gmail.com>",
+ "DavidLi119 <han.david.li@gmail.com>",
"DavNej <davnej.dev@gmail.com>",
"Denis Bardadym <bardadymchik@gmail.com>",
"Devin Weaver <suki@tritarget.org>",
@@ -160,6 +165,7 @@
"Gabriel Silk <gabesilk@gmail.com>",
"Gareth Aye <gaye@mozilla.com>",
"Gareth Murphy <gareth.cpm@gmail.com>",
+ "Gastón I. Silva <givanse@gmail.com>",
"Gavin Mogan <GavinM@airg.com>",
"gaye <gaye@mozilla.com>",
"gigadude <gigadude@users.noreply.github.com>",
@@ -197,6 +203,7 @@
"Jakub Nešetřil <jakub@apiary.io>",
"James Bowes <jbowes@repl.ca>",
"James Carr <james.r.carr@gmail.com>",
+ "James D. Rogers <jd2rogers2@gmail.com>",
"James G. Kim <jgkim@jayg.org>",
"James Lal <james@lightsofapollo.com>",
"James Nylen <jnylen@gmail.com>",
@@ -245,6 +252,7 @@
"JP Bochi <jpbochi@gmail.com>",
"jsdevel <js.developer.undefined@gmail.com>",
"Juerg B <44573692+juergba@users.noreply.github.com>",
+ "juergba <filodron@gmail.com>",
"Julien Wajsberg <felash@gmail.com>",
"Jupp Müller <jupp0r@gmail.com>",
"Jussi Virtanen <jussi.k.virtanen@gmail.com>",
@@ -412,6 +420,7 @@
"Sulabh Bista <sul4bh@gmail.com>",
"Sune Simonsen <sune@we-knowhow.dk>",
"Svetlana <39729453+Lana-Light@users.noreply.github.com>",
+ "Sylvain <sstephant+github@gmail.com>",
"Szauka <33459309+Szauka@users.noreply.github.com>",
"Tapiwa Kelvin <tapiwa@munzwa.tk>",
"Ted Yavuzkurt <hello@TedY.io>",
@@ -453,6 +462,7 @@
"wsw <wsw0108@gmail.com>",
"Xavier Antoviaque <xavier@antoviaque.org>",
"Xavier Damman <xdamman@gmail.com>",
+ "XhmikosR <xhmikosr@gmail.com>",
"XhmikosR <xhmikosr@users.sourceforge.net>",
"Yanis Wang <yanis.wang@gmail.com>",
"yehiyam <yehiyam@users.noreply.github.com>",
@@ -497,11 +507,11 @@
"debug": "3.2.6",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
- "findup-sync": "2.0.0",
+ "find-up": "3.0.0",
"glob": "7.1.3",
"growl": "1.10.5",
"he": "1.2.0",
- "js-yaml": "3.12.0",
+ "js-yaml": "3.13.0",
"log-symbols": "2.2.0",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
@@ -512,40 +522,41 @@
"supports-color": "6.0.0",
"which": "1.3.1",
"wide-align": "1.1.3",
- "yargs": "12.0.5",
- "yargs-parser": "11.1.1",
+ "yargs": "13.2.2",
+ "yargs-parser": "13.0.0",
"yargs-unparser": "1.5.0"
},
"devDependencies": {
"@11ty/eleventy": "^0.7.1",
"@mocha/contributors": "^1.0.3",
- "@mocha/docdash": "^2.0.0",
- "assetgraph-builder": "^6.6.3",
+ "@mocha/docdash": "^2.1.0",
+ "assetgraph-builder": "^6.10.0",
+ "autoprefixer": "^9.4.10",
"browserify": "^16.2.3",
"browserify-package-json": "^1.0.1",
"chai": "^4.2.0",
- "coffee-script": "^1.10.0",
- "coveralls": "^3.0.2",
+ "coffee-script": "^1.12.7",
+ "coveralls": "^3.0.3",
"cross-env": "^5.2.0",
"cross-spawn": "^6.0.5",
- "eslint": "^5.14.1",
+ "eslint": "^5.15.0",
"eslint-config-prettier": "^3.6.0",
"eslint-config-semistandard": "^13.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
- "eslint-plugin-prettier": "^3.0.0",
+ "eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
- "husky": "^1.2.1",
+ "husky": "^1.3.1",
"jsdoc": "^3.5.5",
- "karma": "^4.0.0",
+ "karma": "^4.0.1",
"karma-browserify": "^6.0.0",
- "karma-chrome-launcher": "^2.0.0",
+ "karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
- "karma-mocha-reporter": "^2.2.4",
- "karma-sauce-launcher": "^1.2.0",
- "lint-staged": "^8.1.4",
+ "karma-mocha-reporter": "^2.2.5",
+ "karma-sauce-launcher": "^2.0.2",
+ "lint-staged": "^8.1.5",
"markdown-it": "^8.4.2",
"markdown-it-anchor": "^5.0.2",
"markdown-it-attrs": "^2.3.2",
@@ -553,21 +564,21 @@
"markdown-magic": "^0.1.25",
"markdown-magic-package-json": "^2.0.0",
"markdown-toc": "^1.2.0",
- "markdownlint-cli": "^0.13.0",
- "nps": "^5.9.3",
+ "markdownlint-cli": "^0.14.1",
+ "nps": "^5.9.4",
"nyc": "^13.3.0",
"prettier": "^1.16.4",
"remark": "^10.0.1",
"remark-github": "^7.0.6",
"remark-inline-links": "^3.1.2",
- "rewiremock": "^3.12.3",
- "rimraf": "^2.5.2",
- "sinon": "^7.2.4",
+ "rewiremock": "^3.13.0",
+ "rimraf": "^2.6.3",
+ "sinon": "^7.2.7",
"strip-ansi": "^5.0.0",
- "svgo": "^1.1.1",
- "through2": "^3.0.0",
+ "svgo": "^1.2.0",
+ "through2": "^3.0.1",
"to-vfile": "^5.0.2",
- "unexpected": "^10.39.2",
+ "unexpected": "^10.40.2",
"unexpected-eventemitter": "^1.1.3",
"unexpected-sinon": "^10.11.1",
"uslug": "^1.0.4",
@@ -601,11 +612,6 @@
"bracketSpacing": false,
"endOfLine": "auto"
},
- "yargs": {
- "combine-arrays": true,
- "short-option-groups": false,
- "dot-notation": false
- },
"gitter": "https://gitter.im/mochajs/mocha",
"@mocha/contributors": {
"exclude": [