create_multiple_streams.js 611 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. var tape = require('../');
  3. tape.test('createMultipleStreams', function (tt) {
  4. tt.plan(2);
  5. var th = tape.createHarness();
  6. th.createStream();
  7. th.createStream();
  8. var testOneComplete = false;
  9. th('test one', function (tht) {
  10. tht.plan(1);
  11. setTimeout(function () {
  12. tht.pass();
  13. testOneComplete = true;
  14. }, 100);
  15. });
  16. th('test two', function (tht) {
  17. tht.ok(testOneComplete, 'test 1 completed before test 2');
  18. tht.end();
  19. });
  20. th.onFinish(function () {
  21. tt.equal(th._results.count, 2, 'harness test ran');
  22. tt.equal(th._results.fail, 0, "harness test didn't fail");
  23. });
  24. });