From 3db6babc27def550a16309553fdd0290a18a040b Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 17 May 2018 13:26:17 -0400 Subject: [PATCH] Teach waitsFor to display filename + line number on timeout If no error message is given, show the filename and line number when a test fails due to a timeout using waitsFor. Co-authored-by: Max Brunsfeld --- vendor/jasmine.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vendor/jasmine.js b/vendor/jasmine.js index 1b80d662f..ac443e1c8 100644 --- a/vendor/jasmine.js +++ b/vendor/jasmine.js @@ -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;