This question is a continuation of a discussion on the Remove timeout for single jasmine spec GitHub issue.
Query:
Can a single test be configured to never time out?
The Issue:
While it's possible to set a global timeout value using DEFAULT_TIMEOUT_INTERVAL
, or set timeouts for each describe block with beforeEach
/afterEach
, or even on an individual it()
block like below:
it('Has a custom timeout', function() {
expect(true).toBeTruthy();
}, timeout value in milliseconds)
I'm specifically looking to prevent a single test from timing out indefinitely. I tried following the suggestion from the GitHub issue by using Infinity
:
it('Has a custom timeout', function() {
expect(true).toBeTruthy();
}, Infinity)
However, I encountered this error immediately after the test entered the it()
block:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
It seems that using Infinity
as a timeout value may not be allowed, or I might be missing something.
For now, I can use a large hardcoded number as a workaround, but I'd prefer to find a better solution.