Improve Jasmine timeout error message

This commit is contained in:
Ilya Konstantinov
2018-06-12 01:14:33 -07:00
committed by Pivotal
parent e2895a92dc
commit 8c1b80daae
5 changed files with 32 additions and 26 deletions

View File

@@ -1453,7 +1453,7 @@ getJasmineRequireObj().Env = function(j$) {
userContext: function() { return suite.clonedSharedUserContext(); },
queueableFn: {
fn: fn,
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
timeout: timeout || 0
},
throwOnExpectationFailure: throwOnExpectationFailure
});
@@ -1536,7 +1536,7 @@ getJasmineRequireObj().Env = function(j$) {
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
currentDeclarationSuite.beforeEach({
fn: beforeEachFunction,
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
timeout: timeout || 0
});
};
@@ -1545,7 +1545,7 @@ getJasmineRequireObj().Env = function(j$) {
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
currentDeclarationSuite.beforeAll({
fn: beforeAllFunction,
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
timeout: timeout || 0
});
};
@@ -1555,7 +1555,7 @@ getJasmineRequireObj().Env = function(j$) {
afterEachFunction.isCleanup = true;
currentDeclarationSuite.afterEach({
fn: afterEachFunction,
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
timeout: timeout || 0
});
};
@@ -1564,7 +1564,7 @@ getJasmineRequireObj().Env = function(j$) {
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
currentDeclarationSuite.afterAll({
fn: afterAllFunction,
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
timeout: timeout || 0
});
};
@@ -5090,12 +5090,16 @@ getJasmineRequireObj().QueueRunner = function(j$) {
self.globalErrors.pushListener(handleError);
if (queueableFn.timeout) {
if (queueableFn.timeout !== undefined) {
var timeoutInterval = queueableFn.timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
timeoutId = self.setTimeout(function() {
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
var error = new Error(
'Timeout - Async callback was not invoked within ' + timeoutInterval + 'ms ' +
(queueableFn.timeout ? '(custom timeout)' : '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)')
);
onException(error);
next();
}, queueableFn.timeout());
}, timeoutInterval);
}
try {