Comparing version 0.3.2 to 0.3.3
0.3.3 / 2011-12-08 | ||
================== | ||
* Fixed hook timeouts. Closes #120 | ||
* Fixed uncaught exceptions in hooks | ||
0.3.2 / 2011-12-05 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.3.2'; | ||
exports.version = '0.3.3'; | ||
@@ -15,0 +15,0 @@ exports.interfaces = require('./interfaces'); |
@@ -6,3 +6,4 @@ | ||
var EventEmitter = require('events').EventEmitter; | ||
var EventEmitter = require('events').EventEmitter | ||
, debug = require('debug')('runnable'); | ||
@@ -28,3 +29,3 @@ /** | ||
this.sync = ! this.async; | ||
this.timeout(2000); | ||
this._timeout = 2000; | ||
} | ||
@@ -48,2 +49,3 @@ | ||
if (0 == arguments.length) return this._timeout; | ||
debug('timeout %d', ms); | ||
this._timeout = ms; | ||
@@ -50,0 +52,0 @@ return this; |
@@ -7,2 +7,3 @@ | ||
var EventEmitter = require('events').EventEmitter | ||
, debug = require('debug')('runner') | ||
, Test = require('./test') | ||
@@ -63,2 +64,3 @@ , noop = function(){}; | ||
Runner.prototype.grep = function(re){ | ||
debug('grep %s', re); | ||
this._grep = re; | ||
@@ -77,2 +79,3 @@ return this; | ||
Runner.prototype.globals = function(arr){ | ||
debug('globals %j', arr); | ||
arr.forEach(function(arr){ | ||
@@ -155,3 +158,3 @@ this._globals.push(arr); | ||
function next(i) { | ||
var hook = hooks[i]; | ||
var hook = self.currentRunnable = hooks[i]; | ||
if (!hook) return fn(); | ||
@@ -313,3 +316,3 @@ | ||
// execute test and hook(s) | ||
self.emit('test', self.test = test); | ||
self.emit('test', self.test = self.currentRunnable = test); | ||
self.hookDown('beforeEach', function(){ | ||
@@ -342,2 +345,3 @@ self.runTest(function(err){ | ||
debug('run suite %s', suite.fullTitle()); | ||
this.emit('suite', this.suite = suite); | ||
@@ -376,4 +380,7 @@ | ||
debug('start'); | ||
// callback | ||
self.on('end', function(){ | ||
debug('end'); | ||
process.removeListener('uncaughtException', uncaught); | ||
@@ -386,2 +393,3 @@ fn(self.failures); | ||
this.runSuite(this.suite, function(){ | ||
debug('finished running'); | ||
self.emit('end'); | ||
@@ -392,3 +400,4 @@ }); | ||
function uncaught(err){ | ||
self.fail(self.test, err); | ||
debug('uncaught exception'); | ||
self.fail(self.currentRunnable, err); | ||
self.emit('test end', self.test); | ||
@@ -395,0 +404,0 @@ self.emit('end'); |
@@ -7,2 +7,3 @@ | ||
var EventEmitter = require('events').EventEmitter | ||
, debug = require('debug')('suite') | ||
, Hook = require('./hook'); | ||
@@ -70,3 +71,3 @@ | ||
this.root = !title; | ||
this.timeout(2000); | ||
this._timeout = 2000; | ||
} | ||
@@ -89,3 +90,4 @@ | ||
var suite = new Suite(this.title); | ||
suite.timeout(this._timeout); | ||
debug('clone'); | ||
suite.timeout(this.timeout()); | ||
return suite; | ||
@@ -98,3 +100,3 @@ }; | ||
* @param {Number|String} ms | ||
* @return {Suite} for chaining | ||
* @return {Suite|Number} for chaining | ||
* @api private | ||
@@ -104,3 +106,5 @@ */ | ||
Suite.prototype.timeout = function(ms){ | ||
if (0 == arguments.length) return this._timeout; | ||
if (String(ms).match(/s$/)) ms = parseFloat(ms) * 1000; | ||
debug('timeout %d', ms); | ||
this._timeout = parseInt(ms, 10); | ||
@@ -121,2 +125,3 @@ return this; | ||
hook.parent = this; | ||
hook.timeout(this.timeout()); | ||
this._beforeAll.push(hook); | ||
@@ -138,2 +143,3 @@ this.emit('beforeAll', hook); | ||
hook.parent = this; | ||
hook.timeout(this.timeout()); | ||
this._afterAll.push(hook); | ||
@@ -155,2 +161,3 @@ this.emit('afterAll', hook); | ||
hook.parent = this; | ||
hook.timeout(this.timeout()); | ||
this._beforeEach.push(hook); | ||
@@ -172,2 +179,3 @@ this.emit('beforeEach', hook); | ||
hook.parent = this; | ||
hook.timeout(this.timeout()); | ||
this._afterEach.push(hook); | ||
@@ -188,3 +196,3 @@ this.emit('afterEach', hook); | ||
suite.parent = this; | ||
if (this._timeout) suite.timeout(this._timeout); | ||
suite.timeout(this.timeout()); | ||
this.suites.push(suite); | ||
@@ -205,3 +213,3 @@ this.emit('suite', suite); | ||
test.parent = this; | ||
if (this._timeout) test.timeout(this._timeout); | ||
test.timeout(this.timeout()); | ||
this.tests.push(test); | ||
@@ -208,0 +216,0 @@ this.emit('test', test); |
@@ -6,3 +6,4 @@ | ||
var fs = require('fs'); | ||
var fs = require('fs') | ||
, debug = require('debug')('watch'); | ||
@@ -12,2 +13,3 @@ module.exports = function(paths, fn){ | ||
paths.forEach(function(path){ | ||
debug('watch %s', path); | ||
fs.watchFile(path, options, function(curr, prev){ | ||
@@ -14,0 +16,0 @@ if (prev.mtime < curr.mtime) fn(path); |
{ | ||
"name": "mocha" | ||
, "version": "0.3.2" | ||
, "version": "0.3.3" | ||
, "description": "Test framework inspired by JSpec, Expresso, & Qunit" | ||
@@ -18,3 +18,4 @@ , "keywords": ["test", "bdd", "tdd", "tap"] | ||
, "dependencies":{ | ||
"commander": "0.3.2" | ||
"commander": "0.3.2" | ||
, "debug": "*" | ||
} | ||
@@ -21,0 +22,0 @@ , "devDependencies": { |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
135469
78
4811
2
1
+ Addeddebug@*
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)