Skip to content

Commit 1414948

Browse files
committed
[New] Skipped test blocks should output a “SKIP” message.
1 parent 40be685 commit 1414948

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/test.js

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ function Test (name_, opts_, cb_) {
6767
}
6868

6969
Test.prototype.run = function () {
70+
if (this._skip) {
71+
this.comment('SKIP ' + this.name);
72+
}
7073
if (!this._cb || this._skip) {
7174
return this._end();
7275
}

test/skip.js

+28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
var test = require('../');
22
var ran = 0;
33

4+
var concat = require('concat-stream');
5+
var tap = require('tap');
6+
7+
tap.test('test SKIP comment', function (assert) {
8+
assert.plan(1);
9+
10+
var verify = function (output) {
11+
assert.equal(output.toString('utf8'), [
12+
'TAP version 13',
13+
'# SKIP skipped',
14+
'',
15+
'1..0',
16+
'# tests 0',
17+
'# pass 0',
18+
'',
19+
'# ok',
20+
''
21+
].join('\n'));
22+
};
23+
24+
var tapeTest = test.createHarness();
25+
tapeTest.createStream().pipe(concat(verify));
26+
tapeTest('skipped', { skip: true }, function (t) {
27+
t.end();
28+
});
29+
});
30+
31+
432
test('do not skip this', { skip: false }, function(t) {
533
t.pass('this should run');
634
ran ++;

0 commit comments

Comments
 (0)