3

I followed this article here, to try testing a simple api route in Next.js.

This article uses node-mocks-http to mock req and res objects.

It works with normal next api (which doesn't use next-connect, eg. described in the article above), but when I try to use it with an api which uses next-connect, jest throws a timeout error.

Error: Exceeded timeout of 5000ms for a test.
Use jest.setTimeout(newTimeout) to increase 

Looks like the api doesn't respond, but it works when I try it normally through the browser.

juliomalves
  • 42,130
  • 20
  • 150
  • 146

0 Answers0