Comparing version 0.4.0 to 0.5.0
@@ -689,3 +689,3 @@ | ||
exports.version = '0.4.0'; | ||
exports.version = '0.5.0'; | ||
@@ -1775,2 +1775,47 @@ exports.interfaces = require('./interfaces'); | ||
require.register("reporters/teamcity.js", function(module, exports, require){ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var Base = require('./base'); | ||
/** | ||
* Expose `Teamcity`. | ||
*/ | ||
exports = module.exports = Teamcity; | ||
function Teamcity(runner) { | ||
Base.call(this, runner); | ||
var stats = this.stats; | ||
runner.on('start', function() { | ||
console.log("##teamcity[testSuiteStarted name='mocha.suite']"); | ||
}); | ||
runner.on('test', function(test) { | ||
console.log("##teamcity[testStarted name='%s']", test.fullTitle()); | ||
}); | ||
runner.on('fail', function(test, err) { | ||
console.log("##teamcity[testFailed name='%s' message='%s']", test.fullTitle(), err.message); | ||
}); | ||
runner.on('pending', function(test) { | ||
console.log("##teamcity[testIgnored name='%s' message='pending']", test.fullTitle()); | ||
}); | ||
runner.on('test end', function(test) { | ||
console.log("##teamcity[testFinished name='%s' duration='%s']", test.fullTitle(), test.duration); | ||
}); | ||
runner.on('end', function() { | ||
console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='%s']", stats.duration); | ||
}); | ||
} | ||
}); // module: reporters/teamcity.js | ||
require.register("runnable.js", function(module, exports, require){ | ||
@@ -2256,4 +2301,4 @@ | ||
test.passed = true; | ||
self.emit('pass', test); | ||
test.passed = true; | ||
self.emit('test end', test); | ||
@@ -2265,2 +2310,3 @@ self.hookUp('afterEach', next); | ||
this.next = next; | ||
next(); | ||
@@ -2335,7 +2381,15 @@ }; | ||
function uncaught(err){ | ||
var runnable = self.currentRunnable; | ||
debug('uncaught exception'); | ||
self.currentRunnable.clearTimeout(); | ||
self.fail(self.currentRunnable, err); | ||
self.emit('test end', self.test); | ||
self.emit('end'); | ||
runnable.clearTimeout(); | ||
self.fail(runnable, err); | ||
// recover from test | ||
if ('test' == runnable.type) { | ||
self.emit('test end', runnable); | ||
self.hookUp('afterEach', self.next); | ||
// bail on hooks | ||
} else { | ||
self.emit('end'); | ||
} | ||
} | ||
@@ -2600,2 +2654,3 @@ | ||
this.pending = !fn; | ||
this.type = 'test'; | ||
} | ||
@@ -2602,0 +2657,0 @@ |
0.5.0 / 2011-12-14 | ||
================== | ||
* Added: push node_modules directory onto module.paths for relative require Closes #93 | ||
* Added teamcity reporter [blindsey] | ||
* 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 | ||
@@ -3,0 +11,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.4.0'; | ||
exports.version = '0.5.0'; | ||
@@ -15,0 +15,0 @@ exports.interfaces = require('./interfaces'); |
@@ -316,4 +316,4 @@ | ||
test.passed = true; | ||
self.emit('pass', test); | ||
test.passed = true; | ||
self.emit('test end', test); | ||
@@ -325,2 +325,3 @@ self.hookUp('afterEach', next); | ||
this.next = next; | ||
next(); | ||
@@ -395,7 +396,15 @@ }; | ||
function uncaught(err){ | ||
var runnable = self.currentRunnable; | ||
debug('uncaught exception'); | ||
self.currentRunnable.clearTimeout(); | ||
self.fail(self.currentRunnable, err); | ||
self.emit('test end', self.test); | ||
self.emit('end'); | ||
runnable.clearTimeout(); | ||
self.fail(runnable, err); | ||
// recover from test | ||
if ('test' == runnable.type) { | ||
self.emit('test end', runnable); | ||
self.hookUp('afterEach', self.next); | ||
// bail on hooks | ||
} else { | ||
self.emit('end'); | ||
} | ||
} | ||
@@ -402,0 +411,0 @@ |
@@ -25,2 +25,3 @@ | ||
this.pending = !fn; | ||
this.type = 'test'; | ||
} | ||
@@ -27,0 +28,0 @@ |
67
mocha.js
@@ -691,3 +691,3 @@ ;(function(){ | ||
exports.version = '0.4.0'; | ||
exports.version = '0.5.0'; | ||
@@ -1777,2 +1777,47 @@ exports.interfaces = require('./interfaces'); | ||
require.register("reporters/teamcity.js", function(module, exports, require){ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var Base = require('./base'); | ||
/** | ||
* Expose `Teamcity`. | ||
*/ | ||
exports = module.exports = Teamcity; | ||
function Teamcity(runner) { | ||
Base.call(this, runner); | ||
var stats = this.stats; | ||
runner.on('start', function() { | ||
console.log("##teamcity[testSuiteStarted name='mocha.suite']"); | ||
}); | ||
runner.on('test', function(test) { | ||
console.log("##teamcity[testStarted name='%s']", test.fullTitle()); | ||
}); | ||
runner.on('fail', function(test, err) { | ||
console.log("##teamcity[testFailed name='%s' message='%s']", test.fullTitle(), err.message); | ||
}); | ||
runner.on('pending', function(test) { | ||
console.log("##teamcity[testIgnored name='%s' message='pending']", test.fullTitle()); | ||
}); | ||
runner.on('test end', function(test) { | ||
console.log("##teamcity[testFinished name='%s' duration='%s']", test.fullTitle(), test.duration); | ||
}); | ||
runner.on('end', function() { | ||
console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='%s']", stats.duration); | ||
}); | ||
} | ||
}); // module: reporters/teamcity.js | ||
require.register("runnable.js", function(module, exports, require){ | ||
@@ -2258,4 +2303,4 @@ | ||
test.passed = true; | ||
self.emit('pass', test); | ||
test.passed = true; | ||
self.emit('test end', test); | ||
@@ -2267,2 +2312,3 @@ self.hookUp('afterEach', next); | ||
this.next = next; | ||
next(); | ||
@@ -2337,7 +2383,15 @@ }; | ||
function uncaught(err){ | ||
var runnable = self.currentRunnable; | ||
debug('uncaught exception'); | ||
self.currentRunnable.clearTimeout(); | ||
self.fail(self.currentRunnable, err); | ||
self.emit('test end', self.test); | ||
self.emit('end'); | ||
runnable.clearTimeout(); | ||
self.fail(runnable, err); | ||
// recover from test | ||
if ('test' == runnable.type) { | ||
self.emit('test end', runnable); | ||
self.hookUp('afterEach', self.next); | ||
// bail on hooks | ||
} else { | ||
self.emit('end'); | ||
} | ||
} | ||
@@ -2602,2 +2656,3 @@ | ||
this.pending = !fn; | ||
this.type = 'test'; | ||
} | ||
@@ -2604,0 +2659,0 @@ |
{ | ||
"name": "mocha" | ||
, "version": "0.4.0" | ||
, "version": "0.5.0" | ||
, "description": "Test framework inspired by JSpec, Expresso, & Qunit" | ||
@@ -5,0 +5,0 @@ , "keywords": ["test", "bdd", "tdd", "tap"] |
31
test.js
describe('one', function(){ | ||
before(function(){ | ||
console.log('before'); | ||
describe('something', function(){ | ||
it('should one', function(done){ | ||
process.nextTick(function(){ | ||
throw new Error('first failure'); | ||
done(); | ||
}); | ||
}) | ||
it('should two', function(done){ | ||
process.nextTick(function(){ | ||
throw new Error('second failure'); | ||
done(); | ||
}); | ||
}) | ||
describe('two', function(){ | ||
it('should three', function(){ | ||
}) | ||
after(function(){ | ||
console.log('after'); | ||
}) | ||
describe('three', function(){ | ||
it('should four', function(){ | ||
}) | ||
it('should pass', function(){ | ||
}) | ||
}) |
@@ -14,2 +14,8 @@ | ||
}) | ||
}); | ||
it('should allow overriding per-test', function(done){ | ||
this.timeout(1000); | ||
setTimeout(done, 300); | ||
}) | ||
}) | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
204608
86
7608