☕️ Classic, reliable, trusted test framework for Node.js and the browser
Release 1.8.0
TJ Holowaychuk05751b237038
diff --git a/History.md b/History.mdindex 0830afe3..6414f93b 100644--- a/History.md+++ b/History.md@@ -1,23 +1,34 @@-1.7.4 / 2012-12-06+1.8.0 / 2013-01-08+==================++ * add Mocha() options bail support+ * add `Mocha#bail()` method+ * add instanceof check back for inheriting from Error+ * add component.json+ * add diff.js to browser build+ * update growl+ * fix TAP reporter failures comment :D++1.7.4 / 2012-12-06==================* add total number of passes and failures to TAP* remove .bind() calls. re #680* fix indexOf. Closes #680-1.7.3 / 2012-11-30+1.7.3 / 2012-11-30==================* fix uncaught error support for the browser* revert uncaught "fix" which breaks node-1.7.2 / 2012-11-28+1.7.2 / 2012-11-28==================- * fix uncaught errors to expose the original error message+ * fix uncaught errors to expose the original error message-1.7.0 / 2012-11-07+1.7.0 / 2012-11-07==================* add `--async-only` support to prevent false positives for missing `done()`@@ -32,14 +43,14 @@* fix markdown reporter a tags* fix `this.timeout("5s")` support-1.6.0 / 2012-10-02+1.6.0 / 2012-10-02==================* add object diffs when `err.showDiff` is present* add hiding of empty suites when pass/failures are toggled* add faster `.length` checks to `checkGlobals()` before performing the filter-1.5.0 / 2012-09-21+1.5.0 / 2012-09-21==================* add `ms()` to `.slow()` and `.timeout()`@@ -53,7 +64,7 @@* fix relaying of signals [TooTallNate]* fix TAP reporter grep number-1.4.2 / 2012-09-01+1.4.2 / 2012-09-01==================* add support to multiple `Mocha#globals()` calls, and strings@@ -65,14 +76,14 @@* fix client-side API to match node-side [jfirebaugh]* fix mocha in iframe [joliss]-1.4.1 / 2012-08-28+1.4.1 / 2012-08-28==================* add missing `Markdown` export* fix `Mocha#grep()`, escape regexp strings* fix reference error when `devicePixelRatio` is not defined. Closes #549-1.4.0 / 2012-08-22+1.4.0 / 2012-08-22==================* add mkdir -p to `mocha init`. Closes #539@@ -82,12 +93,12 @@* fix HTML progress indicator retina display* fix url-encoding of click-to-grep HTML functionality-1.3.2 / 2012-08-01+1.3.2 / 2012-08-01==================* fix exports double-execution regression. Closes #531-1.3.1 / 2012-08-01+1.3.1 / 2012-08-01==================* add passes/failures toggling to HTML reporter@@ -103,7 +114,7 @@* fix error when clicking pending test in HTML reporter* fix `make tm`-1.3.0 / 2012-07-05+1.3.0 / 2012-07-05==================* add window scrolling to `HTML` reporter@@ -115,12 +126,12 @@* fix `done()` called multiple times with an error test* change `--grep` - regexp escape the input-1.2.2 / 2012-06-28+1.2.2 / 2012-06-28==================* Added 0.8.0 support-1.2.1 / 2012-06-25+1.2.1 / 2012-06-25==================* Added `this.test.error(err)` support to after each hooks. Closes #287@@ -131,7 +142,7 @@* Fixed chars in nyan when his head moves back* Remove `--growl` from test/mocha.opts. Closes #289-1.2.0 / 2012-06-17+1.2.0 / 2012-06-17==================* Added `nyan` reporter [Atsuya Takagi]@@ -141,7 +152,7 @@* Fixed runner emitter leak. closes #432* Fixed omission of .js extension. Closes #454-1.1.0 / 2012-05-30+1.1.0 / 2012-05-30==================* Added: check each `mocha(1)` arg for directories to walk@@ -155,13 +166,13 @@* Fixed issue #325 - add better grep support to js api* Fixed: save timer references to avoid Sinon interfering.-1.0.3 / 2012-04-30+1.0.3 / 2012-04-30==================* Fixed string diff newlines* Fixed: removed mocha.css target. Closes #401-1.0.2 / 2012-04-25+1.0.2 / 2012-04-25==================* Added HTML reporter duration. Closes #47@@ -172,14 +183,14 @@* Fixed #166 - When grepping don't display the empty suites* Removed test/browser/style.css. Closes #385-1.0.1 / 2012-04-04+1.0.1 / 2012-04-04==================* Fixed `.timeout()` in hooks* Fixed: allow callback for `mocha.run()` in client version* Fixed browser hook error display. Closes #361-1.0.0 / 2012-03-24+1.0.0 / 2012-03-24==================* Added js API. Closes #265@@ -194,7 +205,7 @@* Fixed chopping of first char in error reporting. Closes #334 [reported by topfunky]* Fixed terrible FF / Opera stack traces-0.14.1 / 2012-03-06+0.14.1 / 2012-03-06==================* Added lib-cov to _.npmignore_@@ -203,30 +214,30 @@* Removed jQuery dependency* Fixed `--watch`: purge require cache. Closes #266-0.14.0 / 2012-03-01+0.14.0 / 2012-03-01==================* Added string diff support for terminal reporters-0.13.0 / 2012-02-23+0.13.0 / 2012-02-23==================* Added preliminary test coverage support. Closes #5* Added `HTMLCov` reporter* Added `JSONCov` reporter [kunklejr]* Added `xdescribe()` and `xit()` to the BDD interface. Closes #263 (docs * Changed: make json reporter output pretty json- * Fixed node-inspector support, swapped `--debug` for `debug` to match node.+ * Fixed node-inspector support, swapped `--debug` for `debug` to match node.needed)Closes #247-0.12.1 / 2012-02-14+0.12.1 / 2012-02-14==================* Added `npm docs mocha` support [TooTallNate]* Added a `Context` object used for hook and test-case this. Closes #253* Fixed `Suite#clone()` `.ctx` reference. Closes #262-0.12.0 / 2012-02-02+0.12.0 / 2012-02-02==================* Added .coffee `--watch` support. Closes #242@@ -235,14 +246,14 @@ Closes #247* Changed: made HTML progress indicator smaller* Fixed xunit errors attribute [dhendo]-0.10.2 / 2012-01-21+0.10.2 / 2012-01-21==================* Fixed suite count in reporter stats. Closes #222* Fixed `done()` after timeout error reporting [Phil Sung]* Changed the 0-based errors to 1-0.10.1 / 2012-01-17+0.10.1 / 2012-01-17==================* Added support for node 0.7.x@@ -250,7 +261,7 @@ Closes #247* Fixed `--no-colors` option [Jussi Virtanen]* Fixed Arial CSS typo in the correct file-0.10.0 / 2012-01-13+0.10.0 / 2012-01-13==================* Added `-b, --bail` to exit on first exception [guillermo]@@ -261,21 +272,21 @@ Closes #247* Fixed `self.test` reference in runner. Closes #189* Fixed double reporting of uncaught exceptions after timeout. Closes #195-0.8.2 / 2012-01-05+0.8.2 / 2012-01-05==================* Added test-case context support. Closes #113* Fixed exit status. Closes #187* Update commander. Closes #190-0.8.1 / 2011-12-30+0.8.1 / 2011-12-30==================* Fixed reporting of uncaught exceptions. Closes #183* Fixed error message defaulting [indutny]* Changed mocha(1) from bash to node for windows [Nathan Rajlich]-0.8.0 / 2011-12-28+0.8.0 / 2011-12-28==================* Added `XUnit` reporter [FeeFighters/visionmedia]@@ -286,7 +297,7 @@ Closes #247* Fixed mocha(1) --help bin name* Fixed `-d` for `--debug` support-0.7.1 / 2011-12-22+0.7.1 / 2011-12-22==================* Removed `mocha-debug(1)`, use `mocha --debug`@@ -295,13 +306,13 @@ Closes #247* Fixed: platform specific line endings [TooTallNate]* Fixed: escape strings in HTML reporter. Closes #164-0.7.0 / 2011-12-18+0.7.0 / 2011-12-18==================* Added support for IE{7,8} [guille]* Changed: better browser nextTick implementation [guille]-0.6.0 / 2011-12-18+0.6.0 / 2011-12-18==================* Added setZeroTimeout timeout for browser (nicer stack traces). Closes #153@@ -310,7 +321,7 @@ Closes #247* Fixed duplicate reporting for HTML reporter. Closes #154* Fixed silent hook errors in the HTML reporter. Closes #150-0.5.0 / 2011-12-14+0.5.0 / 2011-12-14==================* Added: push node_modules directory onto module.paths for relative require Closes #93@@ -318,7 +329,7 @@ Closes #247* Fixed: recover from uncaught exceptions for tests. Closes #94* Fixed: only emit "test end" for uncaught within test, not hook-0.4.0 / 2011-12-14+0.4.0 / 2011-12-14==================* Added support for test-specific timeouts via `this.timeout(0)`. Closes #134@@ -328,12 +339,12 @@ Closes #247* Fixed "suite" color for light terminals* Fixed `require()` leak spotted by [guillermo]-0.3.6 / 2011-12-09+0.3.6 / 2011-12-09==================* Removed suite merging (for now)-0.3.5 / 2011-12-08+0.3.5 / 2011-12-08==================* Added support for `window.onerror` [guillermo]@@ -341,7 +352,7 @@ Closes #247* Added `mocha.css` to PHONY list.* Added `mocha.js` to PHONY list.-0.3.4 / 2011-12-08+0.3.4 / 2011-12-08==================* Added: allow `done()` to be called with non-Error@@ -349,24 +360,24 @@ Closes #247* Fixed: run afterEach even on failures. Closes #125* Fixed clobbering of current runnable. Closes #121-0.3.3 / 2011-12-08+0.3.3 / 2011-12-08==================* Fixed hook timeouts. Closes #120* Fixed uncaught exceptions in hooks-0.3.2 / 2011-12-05+0.3.2 / 2011-12-05==================* Fixed weird reporting when `err.message` is not present-0.3.1 / 2011-12-04+0.3.1 / 2011-12-04==================* Fixed hook event emitter leak. Closes #117* Fixed: export `Spec` constructor. Closes #116-0.3.0 / 2011-12-04+0.3.0 / 2011-12-04==================* Added `-w, --watch`. Closes #72@@ -376,7 +387,7 @@ Closes #247* Fixed `mocha-debug(1)` on some systems. Closes #232* Fixed growl total, use `runner.total`-0.2.0 / 2011-11-30+0.2.0 / 2011-11-30==================* Added `--globals <names>` to specify accepted globals. Closes #99@@ -384,19 +395,19 @@ Closes #247* Fixed `mocha-debug(1)`. Closes #232* Fixed growl total, use runner.total-0.1.0 / 2011-11-29+0.1.0 / 2011-11-29==================* Added `suiteSetup` and `suiteTeardown` to TDD interface [David Henderson]* Added growl icons. Closes #84* Fixed coffee-script support-0.0.8 / 2011-11-25+0.0.8 / 2011-11-25==================* Fixed: use `Runner#total` for accurate reporting-0.0.7 / 2011-11-25+0.0.7 / 2011-11-25==================* Added `Hook`@@ -406,17 +417,17 @@ Closes #247* Fixed: > 2 calls to done() only report the error once* Fixed: clear timer on failure. Closes #80-0.0.6 / 2011-11-25+0.0.6 / 2011-11-25==================* Fixed return on immediate async error. Closes #80-0.0.5 / 2011-11-24+0.0.5 / 2011-11-24==================* Fixed: make mocha.opts whitespace less picky [kkaefer]-0.0.4 / 2011-11-24+0.0.4 / 2011-11-24==================* Added `--interfaces`@@ -424,13 +435,13 @@ Closes #247* Added `-c, --colors`. Closes #69* Fixed hook timeouts-0.0.3 / 2011-11-23+0.0.3 / 2011-11-23==================* Added `-C, --no-colors` to explicitly disable* Added coffee-script support-0.0.2 / 2011-11-22+0.0.2 / 2011-11-22==================* Fixed global leak detection due to Safari bind() change@@ -438,13 +449,13 @@ Closes #247* Fixed: escape html entities in HTML reporter* Fixed pending test support for HTML reporter. Closes #66-0.0.1 / 2011-11-22+0.0.1 / 2011-11-22==================* Added `--timeout` second shorthand support, ex `--timeout 3s`.* Fixed "test end" event for uncaughtExceptions. Closes #61-0.0.1-alpha6 / 2011-11-19+0.0.1-alpha6 / 2011-11-19==================* Added travis CI support (needs enabling when public)@@ -457,7 +468,7 @@ Closes #247* Fixed errors thrown in sync test-cases due to nextTick* Fixed Base.window.width... again give precedence to 0.6.x-0.0.1-alpha5 / 2011-11-17+0.0.1-alpha5 / 2011-11-17==================* Added `doc` reporter. Closes #33@@ -479,12 +490,12 @@ Closes #247* Added protection against multiple calls to `done()`. Closes #35* Changed: bright yellow for slow Dot reporter tests-0.0.1-alpha1 / 2011-11-08+0.0.1-alpha1 / 2011-11-08==================* Missed this one :)-0.0.1-alpha1 / 2011-11-08+0.0.1-alpha1 / 2011-11-08==================* Initial releasediff --git a/mocha.js b/mocha.jsindex e13f4648..f01d356a 100644--- a/mocha.js+++ b/mocha.js@@ -58,6 +58,293 @@ module.exports = function(type){}); // module: browser/debug.jsrequire.register("browser/diff.js", function(module, exports, require){+/* See license.txt for terms of usage */++/*+ * Text diff implementation.+ *+ * This library supports the following APIS:+ * JsDiff.diffChars: Character by character diff+ * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace+ * JsDiff.diffLines: Line based diff+ *+ * JsDiff.diffCss: Diff targeted at CSS content+ *+ * These methods are based on the implementation proposed in+ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).+ * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927+ */+var JsDiff = (function() {+ function clonePath(path) {+ return { newPos: path.newPos, components: path.components.slice(0) };+ }+ function removeEmpty(array) {+ var ret = [];+ for (var i = 0; i < array.length; i++) {+ if (array[i]) {+ ret.push(array[i]);+ }+ }+ return ret;+ }+ function escapeHTML(s) {+ var n = s;+ n = n.replace(/&/g, "&");+ n = n.replace(/</g, "<");+ n = n.replace(/>/g, ">");+ n = n.replace(/"/g, """);++ return n;+ }+++ var fbDiff = function(ignoreWhitespace) {+ this.ignoreWhitespace = ignoreWhitespace;+ };+ fbDiff.prototype = {+ diff: function(oldString, newString) {+ // Handle the identity case (this is due to unrolling editLength == 0+ if (newString == oldString) {+ return [{ value: newString }];+ }+ if (!newString) {+ return [{ value: oldString, removed: true }];+ }+ if (!oldString) {+ return [{ value: newString, added: true }];+ }++ newString = this.tokenize(newString);+ oldString = this.tokenize(oldString);++ var newLen = newString.length, oldLen = oldString.length;+ var maxEditLength = newLen + oldLen;+ var bestPath = [{ newPos: -1, components: [] }];++ // Seed editLength = 0+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);+ if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {+ return bestPath[0].components;+ }++ for (var editLength = 1; editLength <= maxEditLength; editLength++) {+ for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {+ var basePath;+ var addPath = bestPath[diagonalPath-1],+ removePath = bestPath[diagonalPath+1];+ oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;+ if (addPath) {+ // No one else is going to attempt to use this value, clear it+ bestPath[diagonalPath-1] = undefined;+ }++ var canAdd = addPath && addPath.newPos+1 < newLen;+ var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;+ if (!canAdd && !canRemove) {+ bestPath[diagonalPath] = undefined;+ continue;+ }++ // Select the diagonal that we want to branch from. We select the prior+ // path whose position in the new string is the farthest from the origin+ // and does not pass the bounds of the diff graph+ if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {+ basePath = clonePath(removePath);+ this.pushComponent(basePath.components, oldString[oldPos], undefined, true);+ } else {+ basePath = clonePath(addPath);+ basePath.newPos++;+ this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);+ }++ var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);++ if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {+ return basePath.components;+ } else {+ bestPath[diagonalPath] = basePath;+ }+ }+ }+ },++ pushComponent: function(components, value, added, removed) {+ var last = components[components.length-1];+ if (last && last.added === added && last.removed === removed) {+ // We need to clone here as the component clone operation is just+ // as shallow array clone+ components[components.length-1] =+ {value: this.join(last.value, value), added: added, removed: removed };+ } else {+ components.push({value: value, added: added, removed: removed });+ }+ },+ extractCommon: function(basePath, newString, oldString, diagonalPath) {+ var newLen = newString.length,+ oldLen = oldString.length,+ newPos = basePath.newPos,+ oldPos = newPos - diagonalPath;+ while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {+ newPos++;+ oldPos++;++ this.pushComponent(basePath.components, newString[newPos], undefined, undefined);+ }+ basePath.newPos = newPos;+ return oldPos;+ },++ equals: function(left, right) {+ var reWhitespace = /\S/;+ if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {+ return true;+ } else {+ return left == right;+ }+ },+ join: function(left, right) {+ return left + right;+ },+ tokenize: function(value) {+ return value;+ }+ };++ var CharDiff = new fbDiff();++ var WordDiff = new fbDiff(true);+ WordDiff.tokenize = function(value) {+ return removeEmpty(value.split(/(\s+|\b)/));+ };++ var CssDiff = new fbDiff(true);+ CssDiff.tokenize = function(value) {+ return removeEmpty(value.split(/([{}:;,]|\s+)/));+ };++ var LineDiff = new fbDiff();+ LineDiff.tokenize = function(value) {+ return value.split(/^/m);+ };++ return {+ diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },+ diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },+ diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },++ diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },++ createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {+ var ret = [];++ ret.push("Index: " + fileName);+ ret.push("===================================================================");+ ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));+ ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));++ var diff = LineDiff.diff(oldStr, newStr);+ if (!diff[diff.length-1].value) {+ diff.pop(); // Remove trailing newline add+ }+ diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier++ function contextLines(lines) {+ return lines.map(function(entry) { return ' ' + entry; });+ }+ function eofNL(curRange, i, current) {+ var last = diff[diff.length-2],+ isLast = i === diff.length-2,+ isLastOfType = i === diff.length-3 && (current.added === !last.added || current.removed === !last.removed);++ // Figure out if this is the last line for the given file and missing NL+ if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {+ curRange.push('\\ No newline at end of file');+ }+ }++ var oldRangeStart = 0, newRangeStart = 0, curRange = [],+ oldLine = 1, newLine = 1;+ for (var i = 0; i < diff.length; i++) {+ var current = diff[i],+ lines = current.lines || current.value.replace(/\n$/, "").split("\n");+ current.lines = lines;++ if (current.added || current.removed) {+ if (!oldRangeStart) {+ var prev = diff[i-1];+ oldRangeStart = oldLine;+ newRangeStart = newLine;++ if (prev) {+ curRange = contextLines(prev.lines.slice(-4));+ oldRangeStart -= curRange.length;+ newRangeStart -= curRange.length;+ }+ }+ curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?"+":"-") + entry; }));+ eofNL(curRange, i, current);++ if (current.added) {+ newLine += lines.length;+ } else {+ oldLine += lines.length;+ }+ } else {+ if (oldRangeStart) {+ // Close out any changes that have been output (or join overlapping)+ if (lines.length <= 8 && i < diff.length-2) {+ // Overlapping+ curRange.push.apply(curRange, contextLines(lines));+ } else {+ // end the range and output+ var contextSize = Math.min(lines.length, 4);+ ret.push(+ "@@ -" + oldRangeStart + "," + (oldLine-oldRangeStart+contextSize)+ + " +" + newRangeStart + "," + (newLine-newRangeStart+contextSize)+ + " @@");+ ret.push.apply(ret, curRange);+ ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));+ if (lines.length <= 4) {+ eofNL(ret, i, current);+ }++ oldRangeStart = 0; newRangeStart = 0; curRange = [];+ }+ }+ oldLine += lines.length;+ newLine += lines.length;+ }+ }++ return ret.join('\n') + '\n';+ },++ convertChangesToXML: function(changes){+ var ret = [];+ for ( var i = 0; i < changes.length; i++) {+ var change = changes[i];+ if (change.added) {+ ret.push("<ins>");+ } else if (change.removed) {+ ret.push("<del>");+ }++ ret.push(escapeHTML(change.value));++ if (change.added) {+ ret.push("</ins>");+ } else if (change.removed) {+ ret.push("</del>");+ }+ }+ return ret.join("");+ }+ };+})();++if (typeof module !== "undefined") {+ module.exports = JsDiff;+}}); // module: browser/diff.js@@ -494,7 +781,9 @@ function Hook(title, fn) {* Inherit from `Runnable.prototype`.*/-Hook.prototype = new Runnable;+function F(){};+F.prototype = Runnable.prototype;+Hook.prototype = new F;Hook.prototype.constructor = Hook;@@ -1861,7 +2150,9 @@ function Dot(runner) {* Inherit from `Base.prototype`.*/-Dot.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+Dot.prototype = new F;Dot.prototype.constructor = Dot;}); // module: reporters/dot.js@@ -2593,7 +2884,9 @@ function Landing(runner) {* Inherit from `Base.prototype`.*/-Landing.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+Landing.prototype = new F;Landing.prototype.constructor = Landing;}); // module: reporters/landing.js@@ -2662,7 +2955,9 @@ function List(runner) {* Inherit from `Base.prototype`.*/-List.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+List.prototype = new F;List.prototype.constructor = List;@@ -2800,7 +3095,9 @@ function Min(runner) {* Inherit from `Base.prototype`.*/-Min.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+Min.prototype = new F;Min.prototype.constructor = Min;}); // module: reporters/min.js@@ -3064,7 +3361,9 @@ function write(string) {* Inherit from `Base.prototype`.*/-NyanCat.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+NyanCat.prototype = new F;NyanCat.prototype.constructor = NyanCat;@@ -3156,7 +3455,9 @@ function Progress(runner, options) {* Inherit from `Base.prototype`.*/-Progress.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+Progress.prototype = new F;Progress.prototype.constructor = Progress;@@ -3249,7 +3550,9 @@ function Spec(runner) {* Inherit from `Base.prototype`.*/-Spec.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+Spec.prototype = new F;Spec.prototype.constructor = Spec;@@ -3468,7 +3771,9 @@ function XUnit(runner) {* Inherit from `Base.prototype`.*/-XUnit.prototype = new Base;+function F(){};+F.prototype = Base.prototype;+XUnit.prototype = new F;XUnit.prototype.constructor = XUnit;@@ -3576,7 +3881,9 @@ function Runnable(title, fn) {* Inherit from `EventEmitter.prototype`.*/-Runnable.prototype = new EventEmitter;+function F(){};+F.prototype = EventEmitter.prototype;+Runnable.prototype = new F;Runnable.prototype.constructor = Runnable;@@ -3721,7 +4028,7 @@ Runnable.prototype.run = function(fn){if (this.async) {try {this.fn.call(ctx, function(err){- if (toString.call(err) === "[object Error]") return done(err);+ if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);if (null != err) return done(new Error('done() invoked with non-Error: ' + err));done();});@@ -3815,7 +4122,9 @@ function Runner(suite) {* Inherit from `EventEmitter.prototype`.*/-Runner.prototype = new EventEmitter;+function F(){};+F.prototype = EventEmitter.prototype;+Runner.prototype = new F;Runner.prototype.constructor = Runner;@@ -4355,7 +4664,9 @@ function Suite(title, ctx) {* Inherit from `EventEmitter.prototype`.*/-Suite.prototype = new EventEmitter;+function F(){};+F.prototype = EventEmitter.prototype;+Suite.prototype = new F;Suite.prototype.constructor = Suite;@@ -4620,7 +4931,9 @@ function Test(title, fn) {* Inherit from `Runnable.prototype`.*/-Test.prototype = new Runnable;+function F(){};+F.prototype = Runnable.prototype;+Test.prototype = new F;Test.prototype.constructor = Test;diff --git a/package.json b/package.jsonindex 0fac23c4..855a6189 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "mocha",- "version": "1.7.4",+ "version": "1.8.0","description": "simple, flexible, fun test framework","keywords": ["mocha",