[Feat] Add descriptive messages for skipped asserts#476
Merged
ljharb merged 1 commit intotape-testing:masterfrom Jun 29, 2019
Merged
[Feat] Add descriptive messages for skipped asserts#476ljharb merged 1 commit intotape-testing:masterfrom
ljharb merged 1 commit intotape-testing:masterfrom
Conversation
Collaborator
|
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? |
Contributor
Author
|
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: []
}
]
] |
ljharb
requested changes
Jun 27, 2019
r0mflip
commented
Jun 27, 2019
ljharb
reviewed
Jun 27, 2019
r0mflip
commented
Jun 27, 2019
| 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) { |
Contributor
Author
There was a problem hiding this comment.
I've temporarily marked it as todo
fc2e7d6 to
838d995
Compare
ljharb
approved these changes
Jun 29, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now asserts can take
skipas astringorboolean, strings get printed as the reason for skipping the assert.