Migrate Cypress E2E from cy.intercept to MSW service worker
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -104,8 +104,12 @@ app.directive("tooltip", Tooltip);
|
||||
*/
|
||||
async function enableMocking() {
|
||||
if (import.meta.env.VITE_MSW !== "true") return;
|
||||
const { http, HttpResponse } = await import("msw");
|
||||
const { worker } = await import("./mocks/browser.js");
|
||||
await worker.start({ onUnhandledRequest: "bypass" });
|
||||
// Expose on window so Cypress can add per-test overrides
|
||||
window.__mswWorker__ = worker;
|
||||
window.__msw__ = { http, HttpResponse };
|
||||
}
|
||||
|
||||
enableMocking().then(() => app.mount("#app"));
|
||||
|
||||
Reference in New Issue
Block a user