3

I have around 450 assorted specs written in Jasmine (async & sync) in my codebase. Karma is the test runner which I use for running the tests on a headless chrome browser. Whenever I run the tests as a whole, a few of the tests fail because of the following error: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. When I run these failing tests individually, they pass without any problem.

On every test run (all tests), the failing tests are different i.e., sometimes, async test A and B fails in the first test run and in the second test run, async test C and D fails.

I clearly see that the problem is always with the Async tests, but how do I fix this issue properly. I tried increasing the timeout in the configuration, it does work sometimes but the tests start failing again with the same async timeout error after a few runs. Currently, I have the timeout at 160000 ms.

How can I fix this problem?

Thanks

ShellZero
  • 4,415
  • 12
  • 38
  • 56
  • 1
    Are you connecting to an actually server? Are you aware about its configurations? It might be that the server is incapable of handling so many requests, or (if its a third party) [throttling](https://www.progress.com/blogs/how-to-rate-limit-an-api-query-throttling-made-easy) your requests. – Ray Sep 07 '18 at 04:54

0 Answers0