Skip to content

Commit

Permalink
failing test for calling .end() twice
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Mar 5, 2014
1 parent f8c72ea commit c0a9a29
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/double_end.js
@@ -0,0 +1,34 @@
var tape = require('../');
var tap = require('tap');
var concat = require('concat-stream');

tap.test(function (t) {
t.plan(1);

var test = tape.createHarness();
var tc = tap.createConsumer();

var rows = [];
tc.on('data', function (row) { rows.push(row) });
tc.on('end', function () {
t.deepEqual(rows, [
'TAP version 13',
'double end',
{ id: 1, ok: true, name: 'should be equivalent' },
{ id: 2, ok: false, name: '.end() called twice' },
'tests 2',
'pass 1',
'fail 1',
]);
});

test.createStream().pipe(tc);

test('double end', function (tt) {
tt.equal(1 + 1, 2);
tt.end();
setTimeout(function () {
tt.end();
}, 5);
});
});

0 comments on commit c0a9a29

Please sign in to comment.