mardi 23 mars 2021

mocha test throw timeout error while testing API and make operation to mongodb

i followed this tutorial : https://www.digitalocean.com/community/tutorials/test-a-node-restful-api-with-mocha-and-chai but it always throw timeout error even if i set timeout to 20s

Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a
Promise, ensure it resolves. (G:\node\shop\test\routers\routes.test.js)
      at listOnTimeout (internal/timers.js:549:17)
      at processTimers (internal/timers.js:492:7)

it works well if i dont make any operation to DB, but when i use Models and make any MongoDB operation it gives me this error.

Aucun commentaire:

Enregistrer un commentaire