forked from gooddata/gooddata-ui-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupTests.ts
29 lines (24 loc) · 1.18 KB
/
setupTests.ts
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
// (C) 2023 GoodData Corporation
import { cleanup } from "@testing-library/react";
import { afterEach, expect } from "vitest";
/**
* In order to be able to use extended matchers like "toBeInDocument", we use vitest-dom instead of testing-library/jest-dom.
* The reason for that is that there were type conflicts between vitest and types/jest as dependency of testing-library/jest-dom.
*/
// eslint-disable-next-line import/no-extraneous-dependencies
import * as matchers from "vitest-dom/dist/matchers.js";
// eslint-disable-next-line import/no-extraneous-dependencies
import { 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/no-empty-interface
interface Assertion<T = any> extends TestingLibraryMatchers<typeof expect.stringContaining, T> {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface AsymmetricMatchersContaining extends TestingLibraryMatchers<unknown, unknown> {}
}
expect.extend(matchers);
afterEach(() => {
cleanup();
});