From 9bbbcfe6a28a969dcde53850ebb7673837bdfcb7 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 12 Jul 2023 11:36:52 -0700 Subject: [PATCH] [Fix] Results: show a skip string on tests, not just on assertions --- lib/results.js | 4 +++- test/skip_explanation.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/results.js b/lib/results.js index 5c6440b1..789fd4b7 100644 --- a/lib/results.js +++ b/lib/results.js @@ -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) { diff --git a/test/skip_explanation.js b/test/skip_explanation.js index ed9e5575..0fbf2fef 100644 --- a/test/skip_explanation.js +++ b/test/skip_explanation.js @@ -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', @@ -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: