From b494b188dc4f909ec7ca085e299fefe247d7b1c0 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Thu, 27 Apr 2017 12:14:04 -0700 Subject: [PATCH] [Fix] Stop createStream for creating additional test runner loops --- lib/results.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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; };