diff --git a/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts b/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts index a0ee955acae4..7bf0bf22a430 100644 --- a/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts +++ b/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts @@ -17,21 +17,24 @@ jest.setTimeout(15000); describe('theme translations', () => { it('has base messages files contain EXACTLY all the translations extracted from the theme. Please run "yarn workspace @docusaurus/theme-translations update" to keep base messages files up-to-date', async () => { const baseMessagesDirPath = path.join(__dirname, '../base'); - const baseMessages = Object.fromEntries( - await Promise.all( - ( - await fs.readdir(baseMessagesDirPath) - ).map(async (baseMessagesFile) => - Object.entries( - (await fs.readJSON( - path.join(baseMessagesDirPath, baseMessagesFile), - )) as {[key: string]: string}, + const baseMessages = await fs + .readdir(baseMessagesDirPath) + .then((files) => + Promise.all( + files.map( + (baseMessagesFile): Promise<{[key: string]: string}> => + fs.readJSON(path.join(baseMessagesDirPath, baseMessagesFile)), ), ), - ).then((translations) => - translations.flat().filter(([key]) => !key.endsWith('___DESCRIPTION')), - ), - ); + ) + .then((translations) => + Object.fromEntries( + translations + .map(Object.entries) + .flat() + .filter(([key]) => !key.endsWith('___DESCRIPTION')), + ), + ); const codeMessages = _.mapValues( await extractThemeCodeMessages(), (translation) => translation.message,