From fa586b445cef771d688ee6287f07b19cae30ca19 Mon Sep 17 00:00:00 2001 From: Norman Date: Sun, 15 Oct 2017 13:24:05 -0700 Subject: [PATCH] [Test]: only use one test runner for results, even if multiple streams are created Fixes #105. --- test/create_multiple_streams.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/create_multiple_streams.js diff --git a/test/create_multiple_streams.js b/test/create_multiple_streams.js new file mode 100644 index 00000000..4b87d044 --- /dev/null +++ b/test/create_multiple_streams.js @@ -0,0 +1,31 @@ +var tape = require('../'); + +tape.test('createMultipleStreams', function(tt) { + tt.plan(2); + + var th = tape.createHarness(); + th.createStream() + th.createStream() + + var testOneComplete = false; + + th('test one', function (tht) { + tht.plan(1); + setTimeout( function() { + tht.pass(); + testOneComplete = true; + }, 100); + }); + + th('test two', function (tht) { + tht.ok(testOneComplete, 'test 1 completed before test 2'); + tht.end(); + }); + + th.onFinish(function() { + tt.equal(th._results.count, 2, "harness test ran"); + tt.equal(th._results.fail, 0, "harness test didn't fail"); + }); +}); + +