How to set jasmine.DEFAULT_TIMEOUT_INTERVAL globally?

3124 views
Skip to first unread message

Fernando Costa

unread,
Jun 20, 2018, 6:22:40 AM6/20/18
to karma-users
Hi there,

I'm facing the following error when I run karma with jasmine on my CI server:

Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL

It doesn't happen all times and not with the same tests. So, I believe the CI server is somehow too busy and some tests cannot be completed in less than 5 seconds (normal jasmine timeout interval).

As a workaround, I'm considering to increase jasmine default timeout interval globally. I wouldn't like to modify it as proposed by jasmine docs:

jasmine.DEFAULT_TIMEOUT_INTERVAL can be set globally, outside of any given describe

It works only if jasmine default timeout interval is set on the first executed test and if test execution order never changes.

The way I found to do it was using jasmine helper scripts. These scripts are run before all specs. Therefore, I've tried to add it to the client section of karma config:
 
module.exports = function(config) {
  ...
  config.set({ client: { jasmine: { helpers: [ "helpers/**/*.js"] } }})
  ...
}

However, it seems karma-jasmine plugin doesn't pass this kind of configuration to jasmine. Digging into karma-jasmine code I found adapter.js just read random, stopOnFailure, seed and failFast jasmine options. 

Is there any other way to do it?

Thank you!
Message has been deleted

Fernando Costa

unread,
Jun 21, 2018, 7:27:42 AM6/21/18
to karma-users
Some updates...

I sent pull request #211 to the karma-jasmine project. It creates a new configuration option to globally set jasmine default timeout interval. It uses a different approach than the one I suggested in my original post. If you are a maintainer of this project, I would be grateful if you could take a look.

Thank you!
Reply all
Reply to author
Forward
0 new messages