-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
54 lines (47 loc) · 1.34 KB
/
vitest.setup.ts
File metadata and controls
54 lines (47 loc) · 1.34 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// (C) 2023-2026 GoodData Corporation
// oxlint-disable @typescript-eslint/no-empty-object-type
import { cleanup } from "@testing-library/react";
import { afterEach, expect } from "vitest";
import * as matchers from "vitest-dom/dist/matchers.js";
import { type TestingLibraryMatchers } from "vitest-dom/dist/matchers.js";
/**
* Exports of types and matchers of vitest-dom is currently broken we need export matchers from dist and define types manually
*/
declare module "vitest" {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Assertion<T = any> extends TestingLibraryMatchers<typeof expect.stringContaining, T> {}
// eslint-disable-next-line @typescript-eslint/naming-convention
interface AsymmetricMatchersContaining extends TestingLibraryMatchers<unknown, unknown> {}
}
expect.extend(matchers);
global.ResizeObserver = class ResizeObserver {
observe() {
return null;
}
unobserve() {
return null;
}
disconnect() {
return null;
}
};
global.IntersectionObserver = class IntersectionObserver {
observe() {
return null;
}
unobserve() {
return null;
}
disconnect() {
return null;
}
takeRecords() {
return [];
}
root = null;
rootMargin = "";
thresholds = [];
};
afterEach(() => {
cleanup();
});