8

In my Angular app, I use Karma and Jasmine to run my unit tests.

I'd like to change the default timeout interval for async tests, from the 5 seconds default to, let's say, 10 seconds.

I see that you can use jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000 to accomplish it.

However, I'd like to change it globally, via some configuration file. For example in karma.conf.js but I don't see the defaultTimeoutInterval option available.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252

1 Answers1

16

I've found the answer in the karma-jasmine GitHub repo.

It looks like the right key is timeoutInterval inside karma.conf.js:

module.exports = function(config) {
  config.set({
    client: {
      jasmine: {
        random: true,
        seed: '4321',
        oneFailurePerSpec: true,
        failFast: true,
        timeoutInterval: 10000 // <- this is what I was looking for
      }
    }
  })
}
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252