6aa05693abc7364969a7411dfb1862568e2a430f.svn-base
971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
exports = module.exports = Dump
var Base = require('./base')
, cursor = Base.cursor
, color = Base.color
, useColors = Base.useColors
, util = require('util')
function Dump(runner) {
Base.call(this, runner);
var events = [
'start',
'version',
'suite',
'suite end',
'test',
'pending',
'pass',
'fail',
'test end',
];
var i = process.argv.indexOf('dump')
if (i !== -1) {
var args = process.argv.slice(i + 1)
if (args.length)
events = args
}
runner.on('line', function (c) {
if (c.trim())
process.stderr.write(Base.color('bright yellow', c))
})
events.forEach(function (ev) {
runner.on(ev, function (obj) {
console.log(ev)
if (arguments.length) {
console.log(util.inspect(obj, false, Infinity, useColors))
console.log()
}
})
})
runner.on('end', function () {
console.log('end')
console.log(runner.stats)
console.log()
})
}