1 | var tape = require('../');
|
2 | var tap = require('tap');
|
3 | var concat = require('concat-stream');
|
4 |
|
5 | var stripFullStack = require('./common').stripFullStack;
|
6 | var testWrapper = require('./anonymous-fn/test-wrapper');
|
7 |
|
8 | tap.test('inside anonymous functions', function (tt) {
|
9 | tt.plan(1);
|
10 |
|
11 | var test = tape.createHarness();
|
12 | var tc = function (rows) {
|
13 | var body = stripFullStack(rows.toString('utf8'));
|
14 |
|
15 | tt.same(body, [
|
16 | 'TAP version 13',
|
17 | '# wrapped test failure',
|
18 | 'not ok 1 fail',
|
19 | ' ---',
|
20 | ' operator: fail',
|
21 | ' at: Test.<anonymous> ($TEST/anonymous-fn/test-wrapper.js:$LINE:$COL)',
|
22 | ' stack: |-',
|
23 | ' Error: fail',
|
24 | ' [... stack stripped ...]',
|
25 | ' at $TEST/anonymous-fn.js:$LINE:$COL',
|
26 | ' at Test.<anonymous> ($TEST/anonymous-fn/test-wrapper.js:$LINE:$COL)',
|
27 | ' [... stack stripped ...]',
|
28 | ' ...',
|
29 | '',
|
30 | '1..1',
|
31 | '# tests 1',
|
32 | '# pass 0',
|
33 | '# fail 1'
|
34 | ].join('\n') + '\n');
|
35 | };
|
36 |
|
37 | test.createStream().pipe(concat(tc));
|
38 |
|
39 | test('wrapped test failure', testWrapper(function (t) {
|
40 | t.fail('fail');
|
41 | t.end();
|
42 | }));
|
43 | });
|