Comparing version
1.7.1 / 2012-11-23 | ||
================== | ||
* add better checkmark | ||
* add `.error.{stack,message}` to json-stream and json reporters | ||
1.7.0 / 2012-11-07 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -69,3 +69,3 @@ | ||
exports.symbols = { | ||
ok: '✔', | ||
ok: '✓', | ||
err: '✖', | ||
@@ -313,3 +313,3 @@ dot: '․' | ||
// pass | ||
fmt = color('bright pass', ' ' + exports.symbols.ok) | ||
fmt = color('bright pass', ' ') | ||
+ color('green', ' %d %s complete') | ||
@@ -325,3 +325,3 @@ + color('light', ' (%s)'); | ||
if (stats.pending) { | ||
fmt = color('pending', ' •') | ||
fmt = color('pending', ' ') | ||
+ color('pending', ' %d %s pending'); | ||
@@ -328,0 +328,0 @@ |
@@ -38,2 +38,3 @@ | ||
runner.on('fail', function(test, err){ | ||
test.error = err; | ||
console.log(JSON.stringify(['fail', clean(test)])); | ||
@@ -57,7 +58,16 @@ }); | ||
function clean(test) { | ||
return { | ||
title: test.title | ||
, fullTitle: test.fullTitle() | ||
, duration: test.duration | ||
var obj = { | ||
title: test.title, | ||
fullTitle: test.fullTitle(), | ||
duration: test.duration | ||
}; | ||
if (test.error) { | ||
obj.error = { | ||
message: test.error.message, | ||
stack: test.error.stack | ||
}; | ||
} | ||
return obj; | ||
} |
@@ -39,3 +39,4 @@ | ||
runner.on('fail', function(test){ | ||
runner.on('fail', function(test, err){ | ||
test.error = err; | ||
failures.push(test); | ||
@@ -46,6 +47,6 @@ }); | ||
var obj = { | ||
stats: self.stats | ||
, tests: tests.map(clean) | ||
, failures: failures.map(clean) | ||
, passes: passes.map(clean) | ||
stats: self.stats, | ||
tests: tests.map(clean), | ||
failures: failures.map(clean), | ||
passes: passes.map(clean) | ||
}; | ||
@@ -67,7 +68,16 @@ | ||
function clean(test) { | ||
return { | ||
title: test.title | ||
, fullTitle: test.fullTitle() | ||
, duration: test.duration | ||
var obj = { | ||
title: test.title, | ||
fullTitle: test.fullTitle(), | ||
duration: test.duration | ||
}; | ||
if (test.error) { | ||
obj.error = { | ||
message: test.error.message, | ||
stack: test.error.stack | ||
}; | ||
} | ||
return obj; | ||
} |
@@ -21,2 +21,8 @@ | ||
/** | ||
* Object#toString(). | ||
*/ | ||
var toString = Object.prototype.toString; | ||
/** | ||
* Expose `Runnable`. | ||
@@ -192,3 +198,3 @@ */ | ||
this.fn.call(ctx, function(err){ | ||
if (err instanceof Error) return done(err); | ||
if (toString.call(err) === "[object Error]") return done(err); | ||
if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); | ||
@@ -195,0 +201,0 @@ done(); |
{ | ||
"name": "mocha" | ||
, "version": "1.7.0" | ||
, "version": "1.7.1" | ||
, "description": "simple, flexible, fun test framework" | ||
@@ -5,0 +5,0 @@ , "keywords": ["test", "bdd", "tdd", "tap"] |
@@ -10,26 +10,22 @@ [](http://travis-ci.org/visionmedia/mocha) | ||
``` | ||
project: mocha | ||
commits: 502 | ||
files : 86 | ||
authors: | ||
352 Tj Holowaychuk 70.1% | ||
98 TJ Holowaychuk 19.5% | ||
21 Guillermo Rauch 4.2% | ||
6 James Carr 1.2% | ||
4 Joshua Krall 0.8% | ||
3 Ben Lindsey 0.6% | ||
3 Nathan Rajlich 0.6% | ||
2 FARKAS Máté 0.4% | ||
2 Quang Van 0.4% | ||
1 Steve Mason 0.2% | ||
1 Yuest Wang 0.2% | ||
1 hokaccha 0.2% | ||
1 David Henderson 0.2% | ||
1 Fedor Indutny 0.2% | ||
1 Fredrik Lindin 0.2% | ||
1 Harry Brundage 0.2% | ||
1 Konstantin Käfer 0.2% | ||
1 Maciej Małecki 0.2% | ||
1 Raynos 0.2% | ||
1 Ryunosuke SATO 0.2% | ||
project : mocha | ||
repo age : 1 year, 3 months | ||
active : 233 days | ||
commits : 1034 | ||
files : 114 | ||
authors : | ||
451 TJ Holowaychuk 43.6% | ||
389 Tj Holowaychuk 37.6% | ||
31 Guillermo Rauch 3.0% | ||
13 Attila Domokos 1.3% | ||
8 Jo Liss 0.8% | ||
7 Nathan Rajlich 0.7% | ||
6 James Carr 0.6% | ||
6 Brendan Nee 0.6% | ||
5 John Firebaugh 0.5% | ||
5 Aaron Heckmann 0.5% | ||
4 Joshua Krall 0.4% | ||
4 Xavier Antoviaque 0.4% | ||
4 hokaccha 0.4% | ||
``` | ||
@@ -39,6 +35,4 @@ | ||
- [Konacha](https://github.com/jfirebaugh/konacha) -- for testing Rails applications with Mocha | ||
- [Chai](https://github.com/chaijs/chai) - BDD, TDD, and assert for node & the browser | ||
- [Should.js](http://github.com/visionmedia/should.js) - BDD style assertions for node | ||
- [Expect.js](https://github.com/LearnBoost/expect.js) - BDD style assertions for node & the browser | ||
- [Google Group](http://groups.google.com/group/mochajs) | ||
- [Google Group](http://groups.google.com/group/mochajs) | ||
- [Wiki](https://github.com/visionmedia/mocha/wiki) | ||
- Mocha [Extensions and reporters](https://github.com/visionmedia/mocha/wiki) |
26
test.js
@@ -0,10 +1,26 @@ | ||
// | ||
// describe('something', function(){ | ||
// it('should work', function(){ | ||
// 'foo bar'.should.equal('bar'); | ||
// }) | ||
// }) | ||
// | ||
// describe('something', function(){ | ||
// it('should work', function(){ | ||
// 'foo\nbar\nbaz\nraz\r\n jaz\nsomething\nelse'.should.equal('foo\nbar\nbaz\nraz\r\njaz\nsmething\nelse'); | ||
// }) | ||
// }) | ||
describe('foo', function(){ | ||
before(function(){ | ||
console.log('foo'); | ||
describe('something', function(){ | ||
describe('one', function(){ | ||
it('should fail', function(){ | ||
throw new Error('fail') | ||
}) | ||
}) | ||
it('should bar', function(){ | ||
describe('two', function(){ | ||
it('should work', function(){ | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
346402
0.3%12115
0.56%61
-1.61%36
-14.29%