24 lines
622 B
TypeScript
24 lines
622 B
TypeScript
2 years ago
|
// vitest.setup.ts
|
||
|
import "vitest-canvas-mock";
|
||
5 years ago
|
import "@testing-library/jest-dom";
|
||
2 years ago
|
import { vi } from "vitest";
|
||
1 year ago
|
import polyfill from "./packages/excalidraw/polyfill";
|
||
|
import { testPolyfills } from "./packages/excalidraw/tests/helpers/polyfills";
|
||
1 year ago
|
|
||
|
Object.assign(globalThis, testPolyfills);
|
||
3 years ago
|
|
||
2 years ago
|
require("fake-indexeddb/auto");
|
||
|
|
||
3 years ago
|
polyfill();
|
||
3 years ago
|
|
||
2 years ago
|
vi.mock("nanoid", () => {
|
||
4 years ago
|
return {
|
||
2 years ago
|
nanoid: vi.fn(() => "test-id"),
|
||
4 years ago
|
};
|
||
|
});
|
||
5 years ago
|
// ReactDOM is located inside index.tsx file
|
||
|
// as a result, we need a place for it to render into
|
||
|
const element = document.createElement("div");
|
||
|
element.id = "root";
|
||
|
document.body.appendChild(element);
|