Skip to content

Commit

Permalink
[Fix] Stop createStream for creating additional test runner loops
Browse files Browse the repository at this point in the history
  • Loading branch information
billti authored and ljharb committed Apr 27, 2017
1 parent fb548b3 commit b494b18
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Results () {
this._stream = through();
this.tests = [];
this._only = null;
this._isRunning = false;
}

Results.prototype.createStream = function (opts) {
Expand Down Expand Up @@ -65,14 +66,17 @@ Results.prototype.createStream = function (opts) {
self._stream.pipe(output);
}

nextTick(function next() {
var t;
while (t = getNextTest(self)) {
t.run();
if (!t.ended) return t.once('end', function(){ nextTick(next); });
}
self.emit('done');
});
if (!this._isRunning) {
this._isRunning = true;
nextTick(function next() {
var t;
while (t = getNextTest(self)) {
t.run();
if (!t.ended) return t.once('end', function(){ nextTick(next); });
}
self.emit('done');
});
}

return output;
};
Expand Down

0 comments on commit b494b18

Please sign in to comment.