test(internationalization): globally mock extensions to avoid using import.meta.glob in jest

This commit is contained in:
Jack Westbrook
2025-03-03 09:45:32 +01:00
parent 5e21abeed7
commit edda259bad
3 changed files with 4 additions and 4 deletions
@@ -0,0 +1 @@
export const localeExtensionImports = {};
@@ -13,10 +13,6 @@ import {
VALID_LANGUAGES,
} from './constants';
jest.mock('./extensions.ts', () => {
return {};
});
describe('internationalization constants', () => {
it('should have set the constants correctly', () => {
expect(ENGLISH_US).toBe('en-US');
+3
View File
@@ -34,6 +34,9 @@ i18next.use(initReactI18next).init({
// the factory uses import.meta.url so we can't use it in CommonJS modules.
jest.mock('app/features/dashboard-scene/saving/createDetectChangesWorker.ts');
// mock extension internationalization as it uses import.meta.glob which we can't use in CommonJS modules.
jest.mock('app/core/internationalization/extensions.ts');
// 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 });