diff --git a/lib/results.js b/lib/results.js index 56fdc4ba..0531a101 100644 --- a/lib/results.js +++ b/lib/results.js @@ -24,6 +24,7 @@ function Results () { this._stream = through(); this.tests = []; this._only = null; + this._isRunning = false; } Results.prototype.createStream = function (opts) { @@ -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; };