Skip to content

Commit

Permalink
lib/test: Fall back to the skip message for test titles
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wking committed Jun 8, 2018
1 parent aca4174 commit e4f8183
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e4f8183

Please sign in to comment.