Sometimes, we want to fix jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL error with JavaScript.
In this article, we’ll look at how to fix jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL error with JavaScript.
How to fix jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL error with JavaScript?
To fix jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL error with JavaScript, we should make sure done
is called when async code is finished running.
For instance, we write
it("should work", (done) => {
//...
});
it("should work", () => {
//...
});
to get the done
function in the parameter of the first test.
And we should call it after async code is run in the first test if there’s any.
Conclusion
To fix jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL error with JavaScript, we should make sure done
is called when async code is finished running.