0

I am developing a backend service using meanjs.org scaffold. I have written around 1700 tests and they were working fine. But now, tests just started to act weird. Suddenly a lot of tests fails with error:

 Error: timeout of 10000ms exceeded. Ensure the done() callback is being called in this test.

Callback done() is being called so this is not the problem. The tests were working all the time but now they don't want to work any more. I tried to drop the mongo database, to stop and start mongod process but nothing works.

Did anyone have the same problem of tests not working from time to time?

Jure Malovrh
  • 314
  • 4
  • 11

1 Answers1

0

I answered a similar post maybe it will be helpfull, as the solution is the same.

mocha timout

The problem is that your connection to mongodb probably exceeds the 2000ms timout from mocha.

Community
  • 1
  • 1
sendra
  • 658
  • 1
  • 9
  • 21
  • The timeout is setted to 10000ms, just in case the mongo fails. The problem is tha sometimes tests works and then sometimes they just produce bunch of errors and don't work. So i don't think 2s is a problem since it has more than enough time and most of the apis don't really need a lot of db. – Jure Malovrh Dec 01 '16 at 17:03
  • Sorry, the 2s timout is the mocha default. Have you tried with a biger timout? If you have different errors can you post them? – sendra Dec 02 '16 at 09:07
  • Yes I did, it still didn't work. There are none additional errors, only some of this tests fails. For example today the tests passed without a problem, but maybe someday the won't again. – Jure Malovrh Dec 06 '16 at 07:10