UNPKG

755 BJavaScriptView Raw
1var test = require('tap').test;
2var concat = require('concat-stream');
3var spawn = require('child_process').spawn;
4
5test(function (t) {
6 t.plan(2);
7 var ps = spawn(process.execPath, [ __dirname + '/double_end/double.js' ]);
8 ps.on('exit', function (code) {
9 t.equal(code, 1);
10 });
11 ps.stdout.pipe(concat(function (body) {
12 t.equal(body.toString('utf8'), [
13 'TAP version 13',
14 '# double end',
15 'ok 1 should be equal',
16 'not ok 2 .end() called twice',
17 ' ---',
18 ' operator: fail',
19 ' ...',
20 '',
21 '1..2',
22 '# tests 2',
23 '# pass 1',
24 '# fail 1',
25 ].join('\n') + '\n\n');
26 }));
27});