Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL Error

Tags:

jasmine

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)
like image 929
Parthi Avatar asked Sep 01 '25 03:09

Parthi


2 Answers

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.

like image 80
Fjut Avatar answered Sep 05 '25 20:09

Fjut


Increase the jasmin default time interval. You add below code to conf.js file.

Code:

    jasmineNodeOpts: {
      showColors: true,
      includeStackTrace: true,
      defaultTimeoutInterval: 1440000
     }
like image 39
Optimworks Avatar answered Sep 05 '25 18:09

Optimworks