-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] Add descriptive messages for skipped asserts #476
Conversation
Is this a convenience feature, or something that you'd expect as part of any tap client? Are their other TAP-producing runners that do this? |
TAP indicates that any individual assert can be skipped or marked todo. test('this skipps', { skip: true }, function (t) {
t.fail('doesn\'t run');
t.fail('this doesn\'t run too', { skip: false });
t.end();
});
test('some tests might skip', function (t) {
t.pass('this runs');
t.fail('failing assert is skipped', { skip: true });
t.pass('this runs');
t.end();
});
test('incomplete test', function (t) {
// var platform = process.platform; something like this needed
var platform = 'win32';
t.pass('run sh', { skip: platform !== 'win32' });
t.pass('run openssl', { skip: platform === 'win32' });
t.end();
});
test('incomplete test with explanation', function (t) {
// var platform = process.platform; something like this needed
var platform = 'win32';
t.fail('run sh (conditional skip)', { skip: platform === 'win32' });
t.fail('run openssl', { skip: platform === 'win32' && 'can\'t run on windows platforms' });
t.pass('this runs');
t.end();
});
[
[ 'version', 13 ],
[ 'comment', '# SKIP this skipps\n' ],
[ 'comment', '# some tests might skip\n' ],
[
'assert',
Result { ok: true, id: 1, name: 'this runs', fullname: '' }
],
[
'assert',
Result {
ok: true,
id: 2,
skip: true,
name: 'failing assert is skipped',
fullname: ''
}
],
[
'assert',
Result { ok: true, id: 3, name: 'this runs', fullname: '' }
],
[ 'comment', '# incomplete test\n' ],
[
'assert',
Result { ok: true, id: 4, name: 'run sh', fullname: '' }
],
[
'assert',
Result {
ok: true,
id: 5,
skip: true,
name: 'run openssl',
fullname: ''
}
],
[ 'comment', '# incomplete test with explanation\n' ],
[
'assert',
Result {
ok: true,
id: 6,
skip: true,
name: 'run sh (conditional skip)',
fullname: ''
}
],
[
'assert',
Result {
ok: true,
id: 7,
skip: "can't run on windows platforms",
name: 'run openssl',
fullname: ''
}
],
[
'assert',
Result { ok: true, id: 8, name: 'this runs', fullname: '' }
],
[ 'plan', { start: 1, end: 8 } ],
[ 'comment', '# tests 8\n' ],
[ 'comment', '# pass 8\n' ],
[ 'comment', '# ok\n' ],
[ 'comment', '# skip: 4\n' ],
[
'complete',
FinalResults {
ok: true,
count: 8,
pass: 8,
fail: 0,
bailout: false,
todo: 0,
skip: 4,
plan: FinalPlan {
start: 1,
end: 8,
skipAll: false,
skipReason: '',
comment: ''
},
failures: []
}
]
] |
var common = require('./common'); | ||
var stripFullStack = common.stripFullStack; | ||
|
||
tap.test('tape todo test', { todo: process.versions.node.match(/0\.8\.\d+/) ? 'Fails on node 0.8': false }, function (assert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've temporarily marked it as todo
fc2e7d6
to
838d995
Compare
Now asserts can take
skip
as astring
orboolean
, strings get printed as the reason for skipping the assert.