How to use built-in fetch in tests? #13678
-
Following https://nextjs.org/blog/next-9-4#improved-built-in-fetch-support announcement about built-in fetch support, I removed my usage of But, in my test files, How would you fix that? How can I load the built-in Next.js |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I believe on solution (IMHO not the best) is to use the
And then configure jest to use it.
This way there is no need to change existing code. Happy to hear of other solutions. |
Beta Was this translation helpful? Give feedback.
-
The moment you run |
Beta Was this translation helpful? Give feedback.
The moment you run
import next from 'next'
the polyfill is applied.