Skip to content

Commit 365ceab

Browse files
author
James Halliday
committed
getting further into the child ordering test
1 parent b1c1d6a commit 365ceab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/results.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ module.exports = function (test) {
1616

1717
nextTick(function next () {
1818
var t = results.tests.shift();
19+
if (!t && results.subtests) return;
1920
if (!t) return results.close();
20-
t.on('end', function () { nextTick(next) });
21+
t.on('end', next);
2122
t.run();
2223
});
2324

@@ -30,6 +31,7 @@ function Results (stream) {
3031
this.pass = 0;
3132
this.stream = stream;
3233
this.tests = [];
34+
this.subtests = 0;
3335
}
3436

3537
Results.prototype.push = function (t, parentT) {
@@ -50,8 +52,10 @@ Results.prototype.push = function (t, parentT) {
5052
var subtests = 0;
5153
t.on('test', function (st) {
5254
subtests ++;
55+
self.subtests ++;
5356
st.on('end', function () {
5457
subtests --;
58+
self.subtests --;
5559
if (subtests === 0 && !plan) t.emit('end');
5660
nextTick(function () { onend.call(t) });
5761
});

0 commit comments

Comments
 (0)