You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
npm run test:integration
> card-collector-api@0.0.1 test:integration
> mocha --config test/integration/.mocharc.json test/integration/**/*_spec.js
Routes: Users
GET /users
1) should return a list of users
0 passing (2s)
1 failing
1) Routes: Users
GET /users
should return a list of users:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/workspace/test/integration/controllers/users_spec.js)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)
Another curious think is that I to use ctrl+C command to end my test run.
The text was updated successfully, but these errors were encountered:
I'm running into the same error. What's interesting is that the get() call works without calling .end() and I get a different error about end being called twice if I add it. In my code I'm using the async/await style.
However, for the post() request, when setting the headers, calling .end() is what fixed the specific timeout error for me:
// This causes a timeoutconstresponse=awaitrequest(app).post("/webapp").send({some: "data"}).set('Accept','application/json').set("Authorization",`Bearer ${token}`);// Adding the "end" call resolves the issueconstresponse=awaitrequest(app).post("/webapp").send({some: "data"}).set('Accept','application/json').set("Authorization",`Bearer ${token}`).end();
Update on this, I ended up finding a bug in my POST handler code. There was an error being returned that would normally be handled by a middleware that would turn it into a response. The timeout was occurring because that middleware was not loading. There was no need for .end() once I fixed the issue.
It could be a middleware is missing or a call to send a response.
Hi,
I'm trying to implement some testes on a new project, but when i invoke the end function i have a timeout on return.
Test file
Route file
Error log:
Another curious think is that I to use ctrl+C command to end my test run.
The text was updated successfully, but these errors were encountered: