Skip to content

Commit

Permalink
[Fix] tests without a callback that are *skipped* should not fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 8, 2020
1 parent fe17984 commit 82e316b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Test.prototype.end = function (err) {
Test.prototype._end = function (err) {
var self = this;

if (!this._cb && !this._todo) this.fail('# TODO ' + this.name);
if (!this._cb && !this._todo && !this._skip) this.fail('# TODO ' + this.name);

if (this._progeny.length) {
var t = this._progeny.shift();
Expand Down
13 changes: 12 additions & 1 deletion test/no_callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tap.test('no callback', function (tt) {

tt.same(body, [
'TAP version 13',
'# group',
'# No callback.',
'not ok 1 # TODO No callback.',
' ---',
Expand All @@ -23,6 +24,8 @@ tap.test('no callback', function (tt) {
' Error: # TODO No callback.',
' [... stack stripped ...]',
' ...',
'# SKIP No callback, skipped.',
'# TODO No callback, todo.',
'',
'1..1',
'# tests 1',
Expand All @@ -33,5 +36,13 @@ tap.test('no callback', function (tt) {

test.createStream().pipe(concat(tc));

test('No callback.');
test('group', function (t) {
t.plan(3);

t.test('No callback.');

t.test('No callback, skipped.', { skip: true });

t.test('No callback, todo.', { todo: true });
});
});

0 comments on commit 82e316b

Please sign in to comment.