diff --git a/index.js b/index.js index e76913b9..6ddaab19 100644 --- a/index.js +++ b/index.js @@ -81,7 +81,14 @@ function createHarness (conf_) { test.createStream = function () { if (!results) results = createResultStream(); - nextTick(function () { results.resume() }); + + var _pause = results.pause; + var paused = false; + results.pause = function () { paused = true }; + + nextTick(function () { + if (!paused) results.resume(); + }); return results; }; diff --git a/lib/results.js b/lib/results.js index 793c2842..a7bff02c 100644 --- a/lib/results.js +++ b/lib/results.js @@ -115,7 +115,7 @@ Results.prototype.push = function (t, parentT) { Results.prototype.close = function () { var self = this; -if (self.closed) self.stream.emit('error', new Error('ALREADY CLOSED')); + if (self.closed) self.stream.emit('error', new Error('ALREADY CLOSED')); self.closed = true; var write = function (s) { self.stream.queue(s) };