Skip to content

Commit 463afd2

Browse files
author
James Halliday
committed
trailing tap data
1 parent 53ab0e8 commit 463afd2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ function createHarness () {
1717
conf = {};
1818
}
1919
var t = new Test;
20-
out.push(t);
21-
20+
t.name = name;
2221
var piped = false;
2322

2423
t.pipe = function () {
@@ -35,6 +34,7 @@ function createHarness () {
3534

3635
var run = function () {
3736
running = true;
37+
out.push(t);
3838
cb(t);
3939
};
4040

lib/render.js

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ function Render () {
66
Stream.call(this);
77
this.readable = true;
88
this.count = 0;
9+
this.fail = 0;
10+
this.pass = 0;
911
}
1012

1113
Render.prototype = new Stream;
@@ -16,13 +18,28 @@ Render.prototype.begin = function () {
1618

1719
Render.prototype.push = function (t) {
1820
var self = this;
21+
this.emit('data', '# ' + t.name + '\n');
22+
1923
t.on('result', function (res) {
2024
self.emit('data', encodeResult(res, self.count + 1));
2125
self.count ++;
26+
27+
if (res.ok) self.pass ++
28+
else self.fail ++
2229
});
2330
};
2431

2532
Render.prototype.close = function () {
33+
this.emit('data', '\n1..' + this.count + '\n');
34+
this.emit('data', '# tests ' + this.count + '\n');
35+
this.emit('data', '# pass ' + this.pass + '\n');
36+
if (this.fail) {
37+
this.emit('data', '# fail ' + this.fail + '\n');
38+
}
39+
else {
40+
this.emit('data', '\n# ok\n');
41+
}
42+
2643
this.emit('end');
2744
};
2845

0 commit comments

Comments
 (0)