UNPKG

1.33 kBJavaScriptView Raw
1'use strict';
2
3var tape = require('../');
4var tap = require('tap');
5var concat = require('concat-stream');
6
7var stripFullStack = require('./common').stripFullStack;
8var testWrapper = require('./anonymous-fn/test-wrapper');
9
10tap.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: Test.<anonymous> ($TEST/anonymous-fn/test-wrapper.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 ].join('\n') + '\n');
37 };
38
39 test.createStream().pipe(concat(tc));
40
41 test('wrapped test failure', testWrapper(function (t) {
42 t.fail('fail');
43 t.end();
44 }));
45});