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
When a request is intercepted by msw, the result returned by msw should be accessible in the test. However, if vi.mock is used in the test, the request intercepted by msw will be hung in the browser. This issue only exists in browser mode.
I am not sure if this issue is the same as #6540 and #6766, but it seems to be somewhat related.
update 1: #6766 exactly the same problem, and there is another issue thread in msw
Reproduction is simple, just use vi.mock to ANY module will prevent msw return response.
The following codes will not work:
exportconstworker=setupWorker(http.get("https://example.com/user",()=>{returnHttpResponse.text("ok");}));it("should work with msw",async()=>{awaitworker.start();vi.mock("empty-npm-package");// this line will prevent msw return responseconstresp=awaitfetch("https://example.com/user");expect(resp.ok).toBeTruthy();});
Describe the bug
When a request is intercepted by msw, the result returned by msw should be accessible in the test. However, if
vi.mock
is used in the test, the request intercepted by msw will be hung in the browser. This issue only exists in browser mode.I am not sure if this issue is the same as #6540 and #6766, but it seems to be somewhat related.
update 1:
#6766 exactly the same problem, and there is another issue thread in msw
Reproduction
Reproduction is simple, just use
vi.mock
to ANY module will prevent msw return response.The following codes will not work:
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: