diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index 4856c34aa7d..3fdbeed1d75 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -11,13 +11,29 @@ describe('locale imports', () => { expect(faker.locale).toBe(locale); }); - // Internal test to cover `src/locale/*.ts` - it(`should be possible to directly require('../locale/${locale}')`, () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { faker } = require(`../locale/${locale}`); + it(`should be possible to directly import('@faker-js/faker/locale/${locale}')`, async () => { + const { faker } = await import(`../dist/esm/locale/${locale}`); expect(faker).toBeDefined(); expect(faker.locale).toBe(locale); }); + + describe('Internal tests to cover `src/locale/*.ts`', () => { + it(`should be possible to directly require('../locale/${locale}')`, () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { faker } = require(`../locale/${locale}`); + + expect(faker).toBeDefined(); + expect(faker.locale).toBe(locale); + }); + + it(`should be possible to directly import('../src/locale/${locale}')`, async () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { faker } = await import(`../src/locale/${locale}`); + + expect(faker).toBeDefined(); + expect(faker.locale).toBe(locale); + }); + }); } });