From c6a1db6bd11820264d971478f1bc5ccfefc2ca69 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 10 Apr 2026 12:19:00 -0400 Subject: [PATCH] fix: Flaky i18n test from repeated singleton re-initialization (#11999) * fix: Flaky i18n test from repeated singleton re-initialization Co-Authored-By: Claude Opus 4.6 * fix: Remove redundant initI18n call, rely on global test setup initI18n() is already called in app/test/setup.ts for all app tests. The extra call in beforeAll could re-introduce the same race condition. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- app/utils/i18n.test.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/utils/i18n.test.ts b/app/utils/i18n.test.ts index 99210bbb98..14cc5b267f 100644 --- a/app/utils/i18n.test.ts +++ b/app/utils/i18n.test.ts @@ -2,19 +2,18 @@ import i18n from "i18next"; import de_DE from "../../shared/i18n/locales/de_DE/translation.json"; import en_US from "../../shared/i18n/locales/en_US/translation.json"; import pt_PT from "../../shared/i18n/locales/pt_PT/translation.json"; -import { initI18n } from "./i18n"; -function addResources() { +// i18n is already initialized globally via app/test/setup.ts — only add +// test resources here, without re-initializing the singleton. +beforeAll(() => { i18n .addResources("en-US", "translation", en_US) .addResources("de-DE", "translation", de_DE) .addResources("pt-PT", "translation", pt_PT); -} +}); describe("i18n env is unset", () => { beforeEach(async () => { - initI18n(); - addResources(); await i18n.changeLanguage("en-US"); }); @@ -34,8 +33,6 @@ describe("i18n env is unset", () => { describe("i18n env is en-US", () => { beforeEach(async () => { - initI18n("en-US"); - addResources(); await i18n.changeLanguage("en-US"); }); @@ -55,8 +52,6 @@ describe("i18n env is en-US", () => { describe("i18n env is de-DE", () => { beforeEach(async () => { - initI18n("de-DE"); - addResources(); await i18n.changeLanguage("de-DE"); }); @@ -76,8 +71,6 @@ describe("i18n env is de-DE", () => { describe("i18n env is pt-PT", () => { beforeEach(async () => { - initI18n("pt-PT"); - addResources(); await i18n.changeLanguage("pt-PT"); });