Skip to content

vitest browser mode issues #130

@charlieforward9

Description

@charlieforward9

I am having a lot of trouble with vitest browser mode and this mocking. I am trying to create a reproduction in one of the StackBlitzs' but not having much success.

With msw browser and vitest browser configured, I am unable to run this snippet.

import { describe, expect, it } from "vitest";
import { downloadData } from "aws-amplify/storage";

it("should download data", async () => {
  const data = downloadData({ path: "mock.json" }); //[ERROR] 01:19.801 xhr-http-handler - Network Error
  const result = await data.result;
  expect(result).toBeDefined();
});

It works in-app, and with setupServer mocking, but when I switch over to browser mode, it fails.

[ERROR] 01:19.801 xhr-http-handler - Network Error

Amplify requires an auth request prior to calling any of its APIs, and these mocked requests are fulfilled with my mocked auth responses located right next to the mocked S3 mocks.

I have to move to Browser mode to test my Leaflet map interactions, this is a severe blocker for my progress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions