From e4f818396e15addaf3c26640382eaa1d664930f1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 7 Jun 2018 20:54:12 -0700 Subject: [PATCH] lib/test: Fall back to the skip message for test titles Skips like [1]: ok 23 # skip Insufficient flogiston pressure. are parsed (at least by tap-parser@1.2.2) into structures like: { id: 1, name: "", ok: true, skip: "root.readonly is false but the root filesystem is still not writable" } But title-less tests are not very useful. With this change, cases like the above empty-string name will fall back to the skip value. And if that skip value is undefined, we'll fall back to an empty string (because I'm not sure how well downstream consumers would handle and undefined title). One positive effect of this change is that Mochawesome now has a title message to render for these skips (where previously it just used an empty h4). [1]: https://testanything.org/tap-version-13-specification.html#skipping-tests --- lib/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test.js b/lib/test.js index 97dcd4b..a5e0f56 100644 --- a/lib/test.js +++ b/lib/test.js @@ -6,7 +6,7 @@ function Test (result, suite) { this.result = result this._slow = 75 this.duration = result.time - this.title = result.name + this.title = result.name || result.skip || '' this.pending = result.todo || false if (result.ok) { this.state = result.skip ? 'skipped' : 'passed'