Skip to content

Commit 6252fd2

Browse files
author
James Halliday
committed
nested test at least finishes now
1 parent 7951747 commit 6252fd2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/results.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Results.prototype.push = function (t) {
4747
t.on('test', function (st) {
4848
subtests ++;
4949
st.on('end', function () {
50-
nextTick(function () {
51-
if (--subtests === 0 && !plan) t.emit('end');
52-
});
50+
subtests --;
51+
if (subtests === 0 && !plan) t.emit('end');
52+
onend();
5353
});
5454
self.push(st);
5555
});
@@ -66,13 +66,15 @@ Results.prototype.push = function (t) {
6666
else self.fail ++
6767
});
6868

69-
t.on('end', function () {
69+
t.on('end', onend);
70+
71+
function onend () {
7072
nextTick(function () {
71-
if (subtests === 0) return;
73+
if (subtests !== 0) return;
7274
if (self.tests.length === 0) self.close();
7375
else self.tests.shift().run();
7476
});
75-
});
77+
}
7678
};
7779

7880
Results.prototype.close = function () {

0 commit comments

Comments
 (0)