SolidJSS
SolidJSโ€ข3y agoโ€ข
1 reply
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());
Was this page helpful?