Skip to content

Commit

Permalink
[New] Skipped test blocks should output a “SKIP” message.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 2, 2016
1 parent 40be685 commit 1414948
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ function Test (name_, opts_, cb_) {
}

Test.prototype.run = function () {
if (this._skip) {
this.comment('SKIP ' + this.name);
}
if (!this._cb || this._skip) {
return this._end();
}
Expand Down
28 changes: 28 additions & 0 deletions test/skip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
var test = require('../');
var ran = 0;

var concat = require('concat-stream');
var tap = require('tap');

tap.test('test SKIP comment', function (assert) {
assert.plan(1);

var verify = function (output) {
assert.equal(output.toString('utf8'), [
'TAP version 13',
'# SKIP skipped',
'',
'1..0',
'# tests 0',
'# pass 0',
'',
'# ok',
''
].join('\n'));
};

var tapeTest = test.createHarness();
tapeTest.createStream().pipe(concat(verify));
tapeTest('skipped', { skip: true }, function (t) {
t.end();
});
});


test('do not skip this', { skip: false }, function(t) {
t.pass('this should run');
ran ++;
Expand Down

0 comments on commit 1414948

Please sign in to comment.