Closed davidtaboas closed 10 months ago
Hey, @davidtaboas. Thanks for reporting this.
Please, could you share a reproduction repository for this? It looks like you are running your code in an environment that doesn't correctly implement the global Fetch API (not sure why core-js
is even needed here). I cannot help much without the way to reproduce this.
@kettanaito ok. i will try it.
I'm using msw in a jsdom environment with jest, using undici to polyfill fetch.
Take a look at the Jest+MSW usage example. It may help you spot what may be off.
Why do you need to polyfill fetch? What version of Node.js are you using? Make sure to use Node.js v18+ with MSW 2.0.
@kettanaito I did, thanks.
But it was no help. However, I removed "core-js" import from my jest.polyfills.js and now it seems to work properly. I will double check a few more times. Meanwhile this issue can still closed.
Thanks!
The issue is that Jest depends on core-js
anyway. Although they are grabbing global.structuredClone
, it appears it's already polyfilled by core-js
at that moment of access.
Using msw 2.0.2 I'm getting the following error:
If i change in this line https://github.com/mswjs/interceptors/blob/3258f5cc62c472ba63f5c70e455d5b245c74a216/src/interceptors/fetch/index.ts#L122
to this, works properly: