Skip to content

Commit

Permalink
update test/timeoutAfter.js to use concat-stream instead of tap.creat…
Browse files Browse the repository at this point in the history
…eConsumer (method unavailable in tap v7) see: #312 (comment)
  • Loading branch information
nelsonic committed Sep 2, 2016
1 parent fd7eb30 commit db3a45e
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions test/timeoutAfter.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
var tape = require('../');
var tap = require('tap');
var trim = require('string.prototype.trim');
var concat = require('concat-stream');

tap.test('timeoutAfter test', function (tt) {
tt.plan(1);

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

var rows = [];
tc.on('data', function (r) { rows.push(r) });
tc.on('end', function () {
var rs = rows.map(function (r) {
if (r && typeof r === 'object') {
return { id : r.id, ok : r.ok, name : trim(r.name) };
}
else return r;
});
tt.same(rs, [
var tc = function (rows) {
tt.same(rows.toString('utf8'), [
'TAP version 13',
'timeoutAfter',
{ id: 1, ok: false, name: 'test timed out after 1ms' },
'tests 1',
'pass 0',
'fail 1'
]);
});

test.createStream().pipe(tc);

'# timeoutAfter',
'not ok 1 test timed out after 1ms',
' ---',
' operator: fail',
' ...',
'',
'1..1',
'# tests 1',
'# pass 0',
'# fail 1'
].join('\n') + '\n');
};

test.createStream().pipe(concat(tc));

test('timeoutAfter', function (t) {
t.plan(1);
t.timeoutAfter(1);
Expand Down

0 comments on commit db3a45e

Please sign in to comment.