Skip to content

Commit e4f8183

Browse files
committed
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 [email protected]) 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
1 parent aca4174 commit e4f8183

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Test (result, suite) {
66
this.result = result
77
this._slow = 75
88
this.duration = result.time
9-
this.title = result.name
9+
this.title = result.name || result.skip || ''
1010
this.pending = result.todo || false
1111
if (result.ok) {
1212
this.state = result.skip ? 'skipped' : 'passed'

0 commit comments

Comments
 (0)