-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.js
More file actions
23 lines (20 loc) · 858 Bytes
/
vitest.setup.js
File metadata and controls
23 lines (20 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { vi } from "vitest";
import "./src/index.css";
import "./src/App.css";
import "@testing-library/jest-dom/vitest"; // needed for .toBeVisible and othern UIs matchers to work https://github.com/testing-library/jest-dom/issues/567#issuecomment-1880205132
// Fixes lottie cannot set ctx.style since its null error
// https://github.com/felippenardi/lottie-react-web/issues/21#issuecomment-2118902716
HTMLCanvasElement.prototype.getContext = () => {
return {
fillStyle: "",
fillRect: vi.fn(),
};
};
vi.mock("./src/utils/common", async () => {
// Import the actual module to retain the original implementation
const actual = await vi.importActual("./src/utils/common");
return {
...actual, // Spread the original implementations
subdomain: vi.fn(() => "volodeptsg"), // Override the specific function you want to mock
};
});