mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
20 lines
725 B
TypeScript
20 lines
725 B
TypeScript
import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
|
|
import matchers from '@testing-library/jest-dom/matchers';
|
|
import { cleanup } from '@testing-library/react';
|
|
import { afterEach, expect } from 'vitest';
|
|
|
|
// Workaround for TypeScript error: https://github.com/testing-library/jest-dom/issues/439#issuecomment-1536524120
|
|
declare module 'vitest' {
|
|
interface Assertion<T = any> extends jest.Matchers<void, T>, TestingLibraryMatchers<T, void> {}
|
|
}
|
|
|
|
// Extends Vitest's expect method with methods from react-testing-library
|
|
expect.extend(matchers);
|
|
|
|
// Clear all mocks and cleanup DOM after every test
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
cleanup();
|
|
});
|
|
|
|
(global as any).scrollTo = () => {};
|