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