Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17351 from atom/improve-message-when-test-fails-d…
Browse files Browse the repository at this point in the history
…ue-to-timeout

Provide more context when test fails due to timeout in `waitsFor`
  • Loading branch information
jasonrudolph committed May 18, 2018
2 parents d02703d + 3db6bab commit 83e7441
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vendor/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,14 @@ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessag
}
}

if (optional_timeoutMessage_ == null) {
const objectToCaptureStack = {}
Error.captureStackTrace(objectToCaptureStack, waitsFor)
const stack = objectToCaptureStack.stack
const line = stack.split('\n')[1]
optional_timeoutMessage_ = `condition ${line}`
}

var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
this.addToQueue(waitsForFunc);
return this;
Expand Down

0 comments on commit 83e7441

Please sign in to comment.