New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSW with Angular Component Testing: Failed to register a Service Worker #26131
Comments
Hi, perhaps duplicate of this issue in the msw repo: mswjs/msw#744 Looks like someone might have a solution in: #16742 Also related: mswjs/msw#744 |
Hi @lmiller1990, this issue is specific to Angular Component Testing. React Component Testing with MSW is working perfectly fine in this repository: cypress-component-testing-apps, so I think the issue is in the configuration files for Webpack in an Angular environment. So not sure about this is duplicated. Thank you! |
I am not able to get it to work in the other project in the repository - I'm not seeing the same error, but I'm also not getting back the expected response. Which project(s) did you see it working in? |
Seems Angular specific. The other issue has an Angular example that is also not working: mswjs/msw#744 (comment) but I got this to work in a simple project (both webpack and Vite). |
I spent a few hours trying to figure this out but I am still unsure. I suppose it's something to do with how Angular routes publicPath requests, but I'm yet to figure out how/what is different compared to other webpack based toolchains. |
I am having the exact same issue but with NextJs instead of Angular. Would love to hear if anyone's been able to get this working! :) |
I tried with the esbuild builder in Angular 16 and it still went looping when I was fetching the MSW service worker. |
Current behavior
For Angular Component Testing, I want to use MSW (Mock Service Worker), using msw request handlers instead of cy.intercept().
The tested component is not working as expected
Desired behavior
MSW needs to be registered succesfully. But this is what happens:
Steps to reproduce:
Test code to reproduce
I forked the repository cypress-component-testing-apps in https://github.com/inigoiparragirre/cypress-component-testing-apps with an example for AppComponent using MSW (main branch).
Cypress Version
12.8.1
Node version
18.14.1
Operating System
Linux Ubuntu 22.10
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: