I am getting Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL Error
Solution 1
Increase the jasmin default time interval. You add below code to conf.js file.
Code:
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 1440000
}
Solution 2
jasmine.DEFAULT_TIMEOUT_INTERVAL
is the period of time in milisecs that Jasmine will wait for a single it
block before throwing a timeout error.
Timeout error can be a sign that something is wrong in your code or that simply it takes more time run. As stated in another answer, you can either increase the global Jasmine timeout interval or, for a single test, set the timeout like this:
const myTestTimeout: number = 2 * 60 * 1000; //explicitly set for readabilty
it('should validate something', (() => { ...your test code }), myTestTimeout);
My approach would be to increase the timeout for that specific test so that you are sure that the test has enough time (e.g. 3 mins). If the test fails again, you can be pretty sure that the cause of the error is an issue in your code.
Solution 3
Add this to karma.conf.js
module.exports = function(config) {
config.set({
client: {
jasmine: {
random: true,
seed: '4321',
oneFailurePerSpec: true,
failFast: true,
timeoutInterval: 1000
}
}
})
}
Source https://github.com/karma-runner/karma-jasmine#configuration
Parthi
QA Lead, Working on Protractor, Appium, Selenium, Galen, UFT, Test Complete Projects
Updated on June 27, 2022Comments
-
Parthi about 2 years
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. Stack: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5)
-
Abby over 5 yearsHi, except adding a timeout, is there any other solutions?