S
SolidJS13mo ago
Sem

No known conditions for "./browser" specifier in "msw" package

I'm trying to setup msw with my test environment in vitest and solid. Any idea why is this caused? Code [setup.ts]:
import { HttpResponse, http } from "msw";
import { afterAll, afterEach, beforeAll } from "vitest";

const {setupWorker} = await import("msw/browser");
const genBars = vi.fn(() => HttpResponse.json([]));
const server = setupWorker(
http.get("http://localhost:3000/api/bars/*", genBars)
);
beforeAll(() => {
server.start();
});
afterEach(() => server.resetHandlers());
import { HttpResponse, http } from "msw";
import { afterAll, afterEach, beforeAll } from "vitest";

const {setupWorker} = await import("msw/browser");
const genBars = vi.fn(() => HttpResponse.json([]));
const server = setupWorker(
http.get("http://localhost:3000/api/bars/*", genBars)
);
beforeAll(() => {
server.start();
});
afterEach(() => server.resetHandlers());
1 Reply
lxsmnsyc
lxsmnsyc13mo ago
this is an issue with MSW, you might want to submit this to them
Want results from more Discord servers?
Add your server