Replies: 2 comments
-
|
Hi, @grgmo. This was a bug that I believe has since been fixed. Please update |
Beta Was this translation helpful? Give feedback.
-
|
The Root cause: Expo's newer networking layer uses a different fetch implementation that may bypass MSW's interceptor registration. In the RN CLI, you were likely using the native Things to check:
server.events.on('request:start', ({ request }) => {
console.log('MSW saw:', request.method, request.url)
})If this fires but
// In your test setup or app entry
await server.listen({ onUnhandledRequest: 'warn' })
import { setupServer } from 'msw/native' // not 'msw/node'
@grgmo Does |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not 100% sure if this is a bug or not.
Just to give a context of what I have got working so far -
react-native->0.81.1msw->2.7.6@react-native-community/cliWorks on both
integrationande2eusing same mocks. I also get life-cycle events ok.I'm currently migrating from
react-native cli->expo cliNot surprisingly both
integrationande2etests stopped working, which I've managed to fix.So all is well but only thing I'm struggling to understand is life-cycle events. I've now stopped getting
response:mockedevent.So I've done more digging and have found that on
expoapp< 2.4.4->response:mockedevent fires> 2.4.3->response:mockedevent DO NOT get firedThis is not a big deal, but if I could patch it somehow.
Looking through the code, it looks like
this.interceptor.on("response"...)does not get firedmsw/src/node/SetupServerCommonApi.ts
Line 110 in e0a4643
So I'm guessing
@mswjs/interceptorsis not firing this event somewhere?Beta Was this translation helpful? Give feedback.
All reactions