diff --git a/index.js b/index.js index 67098d89..2c546120 100644 --- a/index.js +++ b/index.js @@ -15,9 +15,14 @@ var nextTick = typeof setImmediate !== 'undefined' ; exports = module.exports = (function () { - var harness = createHarness(); - harness.createStream().pipe(createDefaultStream()); - return harness; + var harness; + return function () { + if (!harness) { + harness = createHarness(); + harness.createStream().pipe(createDefaultStream()); + } + return harness.apply(this, arguments); + }; })(); exports.createHarness = createHarness; diff --git a/test/array.js b/test/array.js index a4b47c29..2d498632 100644 --- a/test/array.js +++ b/test/array.js @@ -31,7 +31,7 @@ tap.test('array test', function (tt) { ]); }); - test.stream.pipe(tc); + test.createStream().pipe(tc); test('array', function (t) { t.plan(5);