1 | 'use strict';
|
2 |
|
3 | var tap = require('tap');
|
4 | var test = require('../');
|
5 | var concat = require('concat-stream');
|
6 | var stripFullStack = require('./common').stripFullStack;
|
7 |
|
8 | tap.test('test skip explanations', function (assert) {
|
9 | assert.plan(1);
|
10 |
|
11 | var verify = function (output) {
|
12 | assert.deepEqual(stripFullStack(output.toString('utf8')), [
|
13 | 'TAP version 13',
|
14 | '# SKIP (this skips)',
|
15 | '# some tests might skip',
|
16 | 'ok 1 this runs',
|
17 | 'ok 2 failing assert is skipped # SKIP',
|
18 | 'ok 3 this runs',
|
19 | '# incomplete test',
|
20 | 'ok 4 run sh',
|
21 | 'ok 5 run openssl # SKIP',
|
22 | '# incomplete test with explanation',
|
23 | 'ok 6 run sh (conditional skip) # SKIP',
|
24 | 'ok 7 run openssl # SKIP can\'t run on windows platforms',
|
25 | 'ok 8 this runs',
|
26 | '# too much explanation',
|
27 | 'ok 9 run openssl # SKIP Installer cannot work on windows and fails to add to PATH Err: (2401) denied',
|
28 | '',
|
29 | '1..9',
|
30 | '# tests 9',
|
31 | '# pass 9',
|
32 | '',
|
33 | '# ok',
|
34 | ''
|
35 | ]);
|
36 | };
|
37 |
|
38 | var tapeTest = test.createHarness();
|
39 | tapeTest.createStream().pipe(concat(verify));
|
40 |
|
41 | tapeTest('(this skips)', { skip: true }, function (t) {
|
42 | t.fail('doesn\'t run');
|
43 | t.fail('this doesn\'t run too', { skip: false });
|
44 | t.end();
|
45 | });
|
46 |
|
47 | tapeTest('some tests might skip', function (t) {
|
48 | t.pass('this runs');
|
49 | t.fail('failing assert is skipped', { skip: true });
|
50 | t.pass('this runs');
|
51 | t.end();
|
52 | });
|
53 |
|
54 | tapeTest('incomplete test', function (t) {
|
55 |
|
56 | var platform = 'win32';
|
57 |
|
58 | t.pass('run sh', { skip: platform !== 'win32' });
|
59 | t.pass('run openssl', { skip: platform === 'win32' });
|
60 | t.end();
|
61 | });
|
62 |
|
63 | tapeTest('incomplete test with explanation', function (t) {
|
64 |
|
65 | var platform = 'win32';
|
66 |
|
67 | t.fail('run sh (conditional skip)', { skip: platform === 'win32' });
|
68 | t.fail('run openssl', { skip: platform === 'win32' && 'can\'t run on windows platforms' });
|
69 | t.pass('this runs');
|
70 | t.end();
|
71 | });
|
72 |
|
73 | tapeTest('too much explanation', function (t) {
|
74 |
|
75 | var platform = 'win32';
|
76 |
|
77 | t.fail(
|
78 | 'run openssl',
|
79 | { skip: platform === 'win32' && 'Installer cannot work on windows\nand fails to add to PATH\n\n Err: (2401) denied' }
|
80 | );
|
81 | t.end();
|
82 | });
|
83 | });
|
84 |
|
85 |
|