forked from Stellopay/stellopay-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
25 lines (22 loc) · 744 Bytes
/
Copy pathvitest.setup.ts
File metadata and controls
25 lines (22 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import "@testing-library/jest-dom/vitest";
import { configureAxe } from "vitest-axe";
configureAxe();
// jsdom does not implement ResizeObserver, but recharts' ResponsiveContainer
// (used by dashboard/analytics widgets) requires one to mount. Stub it so
// components that render charts don't crash under jsdom.
if (typeof globalThis.ResizeObserver === "undefined") {
class ResizeObserverStub {
observe() {}
unobserve() {}
disconnect() {}
}
globalThis.ResizeObserver =
ResizeObserverStub as unknown as typeof ResizeObserver;
}
if (typeof document !== "undefined" && !document.execCommand) {
Object.defineProperty(document, "execCommand", {
value: () => false,
configurable: true,
writable: true,
});
}