2020-08-20 08:21:42 -05:00
|
|
|
import '@testing-library/jest-dom';
|
2024-02-22 05:31:40 -06:00
|
|
|
import { configure } from '@testing-library/react';
|
2022-10-06 10:34:04 -05:00
|
|
|
import i18next from 'i18next';
|
2022-03-22 12:03:07 -05:00
|
|
|
import failOnConsole from 'jest-fail-on-console';
|
2022-10-06 10:34:04 -05:00
|
|
|
import { initReactI18next } from 'react-i18next';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2020-11-18 08:18:55 -06:00
|
|
|
import { matchers } from './matchers';
|
|
|
|
|
2023-04-27 05:06:11 -05:00
|
|
|
if (process.env.CI) {
|
|
|
|
failOnConsole({
|
|
|
|
shouldFailOnLog: true,
|
|
|
|
shouldFailOnDebug: true,
|
|
|
|
shouldFailOnInfo: true,
|
|
|
|
});
|
|
|
|
}
|
2022-11-09 01:02:24 -06:00
|
|
|
|
2020-11-18 08:18:55 -06:00
|
|
|
expect.extend(matchers);
|
2022-10-06 10:34:04 -05:00
|
|
|
|
|
|
|
i18next.use(initReactI18next).init({
|
|
|
|
resources: {},
|
|
|
|
returnEmptyString: false,
|
|
|
|
lng: 'en-US', // this should be the locale of the phrases in our source JSX
|
|
|
|
});
|
2024-02-22 05:31:40 -06:00
|
|
|
|
2024-02-29 10:18:26 -06:00
|
|
|
// mock out the worker that detects changes in the dashboard
|
|
|
|
// The mock is needed because JSDOM does not support workers and
|
|
|
|
// the factory uses import.meta.url so we can't use it in CommonJS modules.
|
|
|
|
jest.mock('app/features/dashboard-scene/saving/createDetectChangesWorker.ts');
|
|
|
|
|
2024-02-22 05:31:40 -06:00
|
|
|
// our tests are heavy in CI due to parallelisation and monaco and kusto
|
|
|
|
// so we increase the default timeout to 2secs to avoid flakiness
|
|
|
|
configure({ asyncUtilTimeout: 2000 });
|