☕️ Classic, reliable, trusted test framework for Node.js and the browser
Release 0.3.5
Tj Holowaychuka9ddb8e39254
diff --git a/History.md b/History.mdindex 6aef55fb..3448cd0a 100644--- a/History.md+++ b/History.md@@ -1,4 +1,12 @@+0.3.5 / 2011-12-08+==================++ * Added support for `window.onerror` [guillermo]+ * Fixed: clear timeout on uncaught exceptions. Closes #131 [guillermo]+ * Added `mocha.css` to PHONY list.+ * Added `mocha.js` to PHONY list.+0.3.4 / 2011-12-08==================diff --git a/lib/mocha.js b/lib/mocha.jsindex c3b4729b..f2145f48 100644--- a/lib/mocha.js+++ b/lib/mocha.js@@ -9,7 +9,7 @@* Library version.*/-exports.version = '0.3.4';+exports.version = '0.3.5';exports.interfaces = require('./interfaces');exports.reporters = require('./reporters');diff --git a/mocha.css b/mocha.cssindex 092f6e26..58816126 100644--- a/mocha.css+++ b/mocha.css@@ -4,34 +4,34 @@ body {padding: 60px 50px;}-h1, h2 {+#mocha h1, h2 {margin: 0;}-h1 {+#mocha h1 {font-size: 1em;font-weight: 200;}-.suite .suite h1 {+#mocha .suite .suite h1 {font-size: .8em;}-h2 {+#mocha h2 {font-size: 12px;font-weight: normal;cursor: pointer;}-.suite {+#mocha .suite {margin-left: 15px;}-.test {+#mocha .test {margin-left: 15px;}-.test.pass::before {+#mocha .test.pass::before {content: '✓';font-size: 12px;display: block;@@ -40,24 +40,24 @@ h2 {color: #00c41c;}-.test.pending {+#mocha .test.pending {color: #0b97c4;}-.test.pending::before {+#mocha .test.pending::before {content: '◦';color: #0b97c4;}-.test.fail {+#mocha .test.fail {color: #c00;}-.test.fail pre {+#mocha .test.fail pre {color: black;}-.test.fail::before {+#mocha .test.fail::before {content: '✖';font-size: 12px;display: block;@@ -66,11 +66,11 @@ h2 {color: #c00;}-.test pre.error {+#mocha .test pre.error {color: #c00;}-.test pre {+#mocha .test pre {display: inline-block;font: 12px/1.5 monaco, monospace;margin: 5px;@@ -81,14 +81,14 @@ h2 {-webkit-box-shadow: 0 1px 3px #eee;}-#error {+#mocha #error {color: #c00;font-size: 1.5 em;font-weight: 100;letter-spacing: 1px;}-#stats {+#mocha #stats {position: fixed;top: 15px;right: 30px;diff --git a/mocha.js b/mocha.jsindex cfc046cd..5d5f62f3 100644--- a/mocha.js+++ b/mocha.js@@ -433,7 +433,7 @@ require.register("mocha.js", function(module, exports, require){* Library version.*/-exports.version = '0.3.4';+exports.version = '0.3.5';exports.interfaces = require('./interfaces');exports.reporters = require('./reporters');@@ -1555,6 +1555,16 @@ Runnable.prototype.fullTitle = function(){return this.parent.fullTitle() + ' ' + this.title;};+/**+ * Clear the timeout.+ *+ * @api private+ */++Runnable.prototype.clearTimeout = function(){+ clearTimeout(this.timer);+};+/*** Run the test and invoke `fn(err)`.*@@ -1567,12 +1577,11 @@ Runnable.prototype.run = function(fn){, ms = this.timeout(), start = new Date, finished- , emitted- , timer;+ , emitted;// timeoutif (this.async) {- timer = setTimeout(function(){+ this.timer = setTimeout(function(){done(new Error('timeout of ' + ms + 'ms exceeded'));}, ms);}@@ -1587,7 +1596,7 @@ Runnable.prototype.run = function(fn){// finishedfunction done(err) {if (finished) return multiple();- clearTimeout(timer);+ self.clearTimeout();self.duration = new Date - start;finished = true;fn(err);@@ -2014,6 +2023,7 @@ Runner.prototype.run = function(fn){// uncaught exceptionfunction uncaught(err){debug('uncaught exception');+ self.currentRunnable.clearTimeout();self.fail(self.currentRunnable, err);self.emit('test end', self.test);self.emit('end');@@ -2354,20 +2364,25 @@ module.exports = function(paths, fn){*/process = {};-process.nextTick = function(fn){ setTimeout(fn, 0); };+process.exit = function(status){};+process.stdout = {};+global = this;++process.nextTick = function(fn){+ setTimeout(fn, 0);+};+process.removeListener = function(ev){if ('uncaughtException' == ev) {window.onerror = null;}};+process.on = function(ev, fn){if ('uncaughtException' == ev) {window.onerror = fn;}};-process.exit = function(status){};-process.stdout = {};-global = this;mocha = require('mocha');