Skip to content

Commit 642fada

Browse files
committed
Don't end before implicit bailout from bufferend child bailout
1 parent c82c752 commit 642fada

File tree

6 files changed

+81
-1
lines changed

6 files changed

+81
-1
lines changed

lib/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ Test.prototype._runChild = function runChild (child, name, extra, cb) {
586586
extra._tapChildBailed = child._bailedOut
587587
self.ok(child._ok, child._name, extra)
588588

589-
if (endThis) {
589+
if (endThis && !child._bailedOut) {
590590
self._ending = false
591591
self.end(IMPLICIT)
592592
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
TAP version 13
2+
1..1
3+
not ok 1 - parent {
4+
1..1
5+
not ok 1 - child {
6+
1..1
7+
not ok 1 - nope
8+
---
9+
{"at":{"column":7,"file":"test/test/descendant-fail.js","line":7},"source":"t.fail('nope')\n"}
10+
...
11+
12+
Bail out! # nope
13+
}
14+
}
15+
16+
Bail out! # nope
17+

test/test/descendant-fail--bail.tap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
TAP version 13
2+
1..1
3+
# Subtest: parent
4+
1..1
5+
# Subtest: child
6+
1..1
7+
not ok 1 - nope
8+
---
9+
{"at":{"column":7,"file":"test/test/descendant-fail.js","line":7},"source":"t.fail('nope')\n"}
10+
...
11+
12+
Bail out! # nope
13+
Bail out! # nope
14+

test/test/descendant-fail--buffer.tap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
TAP version 13
2+
1..1
3+
not ok 1 - parent {
4+
1..1
5+
not ok 1 - child {
6+
1..1
7+
not ok 1 - nope
8+
---
9+
{"at":{"column":7,"file":"test/test/descendant-fail.js","line":7},"source":"t.fail('nope')\n"}
10+
...
11+
12+
# failed 1 of 1 tests
13+
}
14+
15+
# failed 1 of 1 tests
16+
}
17+
18+
# failed 1 of 1 tests
19+
___/# time=[0-9.]+(ms)?/~~~
20+

test/test/descendant-fail.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var t = require('../..')
2+
t.plan(1)
3+
t.test('parent', function (t) {
4+
t.plan(1)
5+
t.test('child', function (t) {
6+
t.plan(1)
7+
t.fail('nope')
8+
})
9+
})

test/test/descendant-fail.tap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
TAP version 13
2+
1..1
3+
# Subtest: parent
4+
1..1
5+
# Subtest: child
6+
1..1
7+
not ok 1 - nope
8+
---
9+
{"at":{"column":7,"file":"test/test/descendant-fail.js","line":7},"source":"t.fail('nope')\n"}
10+
...
11+
12+
# failed 1 of 1 tests
13+
not ok 1 - child ___/# time=[0-9.]+(ms)?/~~~
14+
15+
# failed 1 of 1 tests
16+
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~
17+
18+
# failed 1 of 1 tests
19+
___/# time=[0-9.]+(ms)?/~~~
20+

0 commit comments

Comments
 (0)