Skip to content

Commit

Permalink
[Fix] Results: show a skip string on tests, not just on assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 12, 2023
1 parent 109a791 commit 9bbbcfe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/results.js
Expand Up @@ -184,12 +184,14 @@ Results.prototype._watch = function (t) {

t.once('prerun', function () {
var premsg = '';
var postmsg = '';
if (t._skip) {
premsg = 'SKIP ';
postmsg = typeof t._skip === 'string' ? ' ' + coalesceWhiteSpaces(t._skip) : '';
} else if (t._todo) {
premsg = 'TODO ';
}
write('# ' + premsg + coalesceWhiteSpaces(t.name) + '\n');
write('# ' + premsg + coalesceWhiteSpaces(t.name) + postmsg + '\n');
});

t.on('result', function (res) {
Expand Down
11 changes: 11 additions & 0 deletions test/skip_explanation.js
Expand Up @@ -25,6 +25,8 @@ tap.test('test skip explanations', function (assert) {
'ok 8 this runs',
'# too much explanation',
'ok 9 run openssl # SKIP Installer cannot work on windows and fails to add to PATH Err: (2401) denied',
'# SKIP skipped subtest description!',
'# SKIP this is a skipped test vs just an assertion skip description!',
'',
'1..9',
'# tests 9',
Expand Down Expand Up @@ -78,8 +80,17 @@ tap.test('test skip explanations', function (assert) {
'run openssl',
{ skip: platform === 'win32' && 'Installer cannot work on windows\nand fails to add to PATH\n\n Err: (2401) denied' }
);

t.test('skipped subtest', { skip: 'description!' }, function (st) {
st.fail('does not run');
});

t.end();
});

tapeTest('this is a skipped test vs just an assertion', { skip: 'skip description!' }, function (t) {
t.fail('does not run');
});
});

// vim: set softtabstop=4 shiftwidth=4:

0 comments on commit 9bbbcfe

Please sign in to comment.