mardi 1 septembre 2015

Infinite jasmine timeout

This is basically a follow-up to Remove timeout for single jasmine spec github issue.

The question:

Is it possible to make a single test never timeout?

The problem:

It is possible to set a timeout value globally via DEFAULT_TIMEOUT_INTERVAL or for every describe with beforeEach/afterEach or on a single it() block:

it('Has a custom timeout', function() {
  expect(true).toBeTruthy();
}, value in msec)

I'm interested in having a single spec never timeout. I've tried to follow the advice proposed in the mentioned github issue and use Infinity:

it('Has a custom timeout', function() {
  expect(true).toBeTruthy();
}, Infinity)

but, I've got the following error immediately after the tests got into the it() block:

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL

I guess I cannot use Infinity as a timeout value, or I'm doing something wrong.


As a workaround, I can use a hardcoded large number instead, but I'd like to avoid that.

Aucun commentaire:

Enregistrer un commentaire