Skip to content

Commit 939e44e

Browse files
committed
Actually print #time at the end of the TAP test
This was emitting a 'data' event, but only after 'end', which does nada.
1 parent 884738f commit 939e44e

File tree

186 files changed

+221
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+221
-2
lines changed

lib/base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,16 @@ Base.prototype.oncomplete = function (results) {
149149
delete f.ok
150150
return f.tapError
151151
})
152+
152153
if (failures.length)
153154
this.options.failures = failures
155+
156+
this.onbeforeend()
154157
this.emit('end')
155158
this.ondone()
156159
}
157160

161+
Base.prototype.onbeforeend = function () {}
158162
Base.prototype.ondone = function () {}
159163

160164
Base.prototype.setupParser = function (options) {

lib/tap.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ TAP.prototype.onbail = function () {
3737
process.exit(1)
3838
}
3939

40-
TAP.prototype.ondone = function () {
41-
if (didPipe && this.time)
40+
TAP.prototype.onbeforeend = function () {
41+
if (didPipe && this.time && !this.bailedOut)
4242
this.emit('data', '# time=' + this.time + 'ms\n')
43+
}
44+
45+
TAP.prototype.ondone = function () {
4346
this.emit('teardown')
4447
}
4548

test/test/assert-at--buffer.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ not ok 1 - foo ___/# time=[0-9.]+(ms)?/~~~ {
2626

2727
1..1
2828
# failed 1 test
29+
___/# time=[0-9.]+(ms)?/~~~
2930

test/test/assert-at.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ not ok 1 - foo ___/# time=[0-9.]+(ms)?/~~~
2626

2727
1..1
2828
# failed 1 test
29+
___/# time=[0-9.]+(ms)?/~~~
2930

test/test/assert-todo-skip--bail--buffer.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ok 1 - not much ___/# time=[0-9.]+(ms)?/~~~ {
2222
}
2323

2424
1..1
25+
___/# time=[0-9.]+(ms)?/~~~
2526

test/test/assert-todo-skip--bail.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ TAP version 13
2222
ok 1 - not much ___/# time=[0-9.]+(ms)?/~~~
2323

2424
1..1
25+
___/# time=[0-9.]+(ms)?/~~~
2526

test/test/assert-todo-skip--buffer.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ok 1 - not much ___/# time=[0-9.]+(ms)?/~~~ {
2222
}
2323

2424
1..1
25+
___/# time=[0-9.]+(ms)?/~~~
2526

test/test/assert-todo-skip.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ TAP version 13
2222
ok 1 - not much ___/# time=[0-9.]+(ms)?/~~~
2323

2424
1..1
25+
___/# time=[0-9.]+(ms)?/~~~
2526

test/test/async--bail--buffer.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ ok 2 - second test (async) ___/# time=[0-9.]+(ms)?/~~~ {
1010
}
1111

1212
1..2
13+
___/# time=[0-9.]+(ms)?/~~~
1314

test/test/async--bail.tap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ ok 1 - first test ___/# time=[0-9.]+(ms)?/~~~
1010
ok 2 - second test (async) ___/# time=[0-9.]+(ms)?/~~~
1111

1212
1..2
13+
___/# time=[0-9.]+(ms)?/~~~
1314

0 commit comments

Comments
 (0)