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
The problem is that those mocks never resolve. they are in place, I can see them with server.listHandlers, and if i manually fire a query like fetch("/api/trpc/questions....") the interceptor works. But on the queries triggered by the trpc client, the query never resolves. It doesn't trigger the interceptor, it doesn't trigger the onUnhandledRequest, but if i remove the msw mock, and spy on fetch i can see the query being done.
I've spent quite some time trying to dig into what it's wrong, but this goes beyond me. Plenty of people seem to have no problem integrating this project in RTL, but they are all using the raw react approach. There is even this thread that partially explains a workaround... but I couldn't get it working for my project.
I would like to have a demo that demonstrates how this setup, or a similar one is possible. My project is quite complicated, but if you want I can try to provide a minimal reproduction with the key functionalities.
Describe alternatives you've considered
use cross-fetch... no effect
remove msw-storybook no effect.
Apply the workaround from here but in my code it was just not practicable.
Additional context
Thanks a lot for this project!
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I would like to request a demo of a next-trpc combined with this project and RTL. Ideally Running in vite.
Describe the solution you'd like
I've set up my project in such a way I would expect things to work. I've wired up this project with
storybook-msw
. Code,The
trpc
client is created withcreateTRPCNext
here. This client is provided to the stories here.Now I want to write tests for these stories. Code
The problem is that those mocks never resolve. they are in place, I can see them with
server.listHandlers
, and if i manually fire a query likefetch("/api/trpc/questions....")
the interceptor works. But on the queries triggered by thetrpc
client, the query never resolves. It doesn't trigger the interceptor, it doesn't trigger theonUnhandledRequest
, but if i remove themsw
mock, and spy onfetch
i can see the query being done.I've spent quite some time trying to dig into what it's wrong, but this goes beyond me. Plenty of people seem to have no problem integrating this project in RTL, but they are all using the raw react approach. There is even this thread that partially explains a workaround... but I couldn't get it working for my project.
I would like to have a demo that demonstrates how this setup, or a similar one is possible. My project is quite complicated, but if you want I can try to provide a minimal reproduction with the key functionalities.
Describe alternatives you've considered
cross-fetch
... no effectmsw-storybook
no effect.Additional context
Thanks a lot for this project!
The text was updated successfully, but these errors were encountered: