Chore: Move structured-clone polyfill to setupTests (#95406)

* Add structured-clone polyfill to setupTests

* Remove manual structured-clone imports
This commit is contained in:
Tom Ratcliffe 2024-10-29 16:40:05 +01:00 committed by GitHub
parent 55afbdc6be
commit 03715f062b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 2 additions and 14 deletions

View File

@ -1,4 +1,3 @@
import 'core-js/stable/structured-clone';
import { clickSelectOption } from 'test/helpers/selectOptionInTest';
import { render, screen, userEvent } from 'test/test-utils';
import { byLabelText, byRole, byTestId, byText } from 'testing-library-selector';

View File

@ -12,7 +12,6 @@ import { grantUserPermissions } from 'app/features/alerting/unified/mocks';
import { setupDataSources } from 'app/features/alerting/unified/testSetup/datasources';
import { AccessControlAction } from 'app/types';
import 'core-js/stable/structured-clone';
import ContactPoints from './components/contact-points/ContactPoints';
import EditContactPoint from './components/contact-points/EditContactPoint';
import NewReceiverView from './components/receivers/NewReceiverView';

View File

@ -1,4 +1,3 @@
import 'core-js/stable/structured-clone';
import { Routes, Route } from 'react-router-dom-v5-compat';
import { render, screen } from 'test/test-utils';
import { byLabelText, byPlaceholderText, byRole, byTestId } from 'testing-library-selector';

View File

@ -19,8 +19,6 @@ import { renderWithProvider } from '../../contact-points/ContactPoints.test';
import { GrafanaReceiverForm } from './GrafanaReceiverForm';
import 'core-js/stable/structured-clone';
setupMswServer();
const ui = {

View File

@ -3,8 +3,6 @@ import { FormProvider, useForm } from 'react-hook-form';
import { screen, render, within } from 'test/test-utils';
import { byRole, byTestId } from 'testing-library-selector';
import 'core-js/stable/structured-clone';
import { DashboardSearchItemType } from '../../../../search/types';
import { mockDashboardApi, setupMswServer } from '../../mockApi';
import { mockDashboardDto, mockDashboardSearchItem } from '../../mocks';

View File

@ -3,8 +3,6 @@ import { Props } from 'react-virtualized-auto-sizer';
import { render } from 'test/test-utils';
import { byRole } from 'testing-library-selector';
import 'core-js/stable/structured-clone';
import { DashboardSearchItemType } from '../../../../search/types';
import { mockDashboardApi, setupMswServer } from '../../mockApi';
import { mockDashboardDto, mockDashboardSearchItem } from '../../mocks';

View File

@ -3,7 +3,6 @@ import { byRole, byTestId, byText } from 'testing-library-selector';
import { AccessControlAction } from 'app/types/accessControl';
import 'core-js/stable/structured-clone';
import { MatcherOperator } from '../../../../../../plugins/datasource/alertmanager/types';
import { Labels } from '../../../../../../types/unified-alerting-dto';
import { mockApi, setupMswServer } from '../../../mockApi';

View File

@ -10,8 +10,6 @@ import {
unquoteRouteMatchers,
} from './notification-policies';
import 'core-js/stable/structured-clone';
const CATCH_ALL_ROUTE: Route = {
receiver: 'ALL',
object_matchers: [],

View File

@ -1,5 +1,3 @@
import 'core-js/stable/structured-clone';
import { NotifierDTO } from 'app/types';
import { Receiver } from '../../../../plugins/datasource/alertmanager/types';

View File

@ -1,3 +1,5 @@
// `structuredClone` is not yet in jsdom https://github.com/jsdom/jsdom/issues/3363
import 'core-js/stable/structured-clone';
import 'whatwg-fetch';
import '@testing-library/jest-dom';
import { configure } from '@testing-library/react';