Error: Timeout - Async callback was not invoked within 5000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL)
The problem is that you need to ensure that the test is finished according to jasmine standards. The easiest way to do this is to use a done
parameter. It would be like this:
describe("test function",funtion(){
it("testing",done => {
test().then(function(data,err){
console.log("resolved Data = ",data)
expect(data).toEqual({id:1}))
done();
}))
})
})
You just need to make sure that done()
is invoked when the test is finished.
I am getting Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL Error
Increase the jasmin default time interval. You add below code to conf.js file.
Code:
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 1440000
}
jasmine 2 - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
You are using the same timeout interval as Jasmine is using to fail tests on timeout, i.e. your timeout is triggered to fire with Jasmine's default interval, which fails the test.
If you set your timeout to be less than jasmine default timeout the test passes.
describe('foo', function () {
beforeEach(function (done) {
window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
setTimeout(function () {
console.log('inside timeout');
done();
}, 500);
});
it('passes', function () {
expect({}).toBeDefined();
});
});
See fiddle here
Related Topics
Check If Object Is a Jquery Object
How to Search JSON Tree with Jquery
JavaScript .Replace Command Replace Page Text
Firestore: What's the Pattern for Adding New Data in Web V9
Extending Built-In Natives in Es6 with Babel
How to Disable Signature Checking for Firefox Add-Ons
Order of Hoisting in JavaScript
Jquery - Script Tags in the HTML Are Parsed Out by Jquery and Not Executed
Node.Js Tail-Call Optimization: Possible or Not
Split String Only on First Instance of Specified Character
How to Sort an Array of Objects Based on the Ordering of Another Array
How to Set a Js Object Property Name from a Variable
Es6: Conditional & Dynamic Import Statements
How to Load a JavaScript File Dynamically
JavaScript Es6 Class Definition Not Accessible in Window Global
Setting Multiple Attributes for an Element at Once with JavaScript