1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/frontend/src/setupTests.ts
2024-09-25 12:56:09 +02:00

34 lines
759 B
TypeScript

import '@testing-library/jest-dom';
import 'whatwg-fetch';
import 'regenerator-runtime';
import { beforeAll, vi } from 'vitest';
class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
if (!window.ResizeObserver) {
window.ResizeObserver = ResizeObserver;
}
process.env.TZ = 'UTC';
// ignore known React warnings
const consoleError = console.error;
beforeAll(() => {
vi.spyOn(console, 'error').mockImplementation((...args) => {
if (
!(
typeof args[0] === 'string' &&
args[0].includes(
'Warning: An update to %s inside a test was not wrapped in act',
)
)
) {
consoleError(...args);
}
});
});