Skip to content

Commit c6a1db6

Browse files
tommoorclaude
andauthored
fix: Flaky i18n test from repeated singleton re-initialization (outline#11999)
* fix: Flaky i18n test from repeated singleton re-initialization Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * 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 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 79df2f2 commit c6a1db6

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

app/utils/i18n.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ import i18n from "i18next";
22
import de_DE from "../../shared/i18n/locales/de_DE/translation.json";
33
import en_US from "../../shared/i18n/locales/en_US/translation.json";
44
import pt_PT from "../../shared/i18n/locales/pt_PT/translation.json";
5-
import { initI18n } from "./i18n";
65

7-
function addResources() {
6+
// i18n is already initialized globally via app/test/setup.ts — only add
7+
// test resources here, without re-initializing the singleton.
8+
beforeAll(() => {
89
i18n
910
.addResources("en-US", "translation", en_US)
1011
.addResources("de-DE", "translation", de_DE)
1112
.addResources("pt-PT", "translation", pt_PT);
12-
}
13+
});
1314

1415
describe("i18n env is unset", () => {
1516
beforeEach(async () => {
16-
initI18n();
17-
addResources();
1817
await i18n.changeLanguage("en-US");
1918
});
2019

@@ -34,8 +33,6 @@ describe("i18n env is unset", () => {
3433

3534
describe("i18n env is en-US", () => {
3635
beforeEach(async () => {
37-
initI18n("en-US");
38-
addResources();
3936
await i18n.changeLanguage("en-US");
4037
});
4138

@@ -55,8 +52,6 @@ describe("i18n env is en-US", () => {
5552

5653
describe("i18n env is de-DE", () => {
5754
beforeEach(async () => {
58-
initI18n("de-DE");
59-
addResources();
6055
await i18n.changeLanguage("de-DE");
6156
});
6257

@@ -76,8 +71,6 @@ describe("i18n env is de-DE", () => {
7671

7772
describe("i18n env is pt-PT", () => {
7873
beforeEach(async () => {
79-
initI18n("pt-PT");
80-
addResources();
8174
await i18n.changeLanguage("pt-PT");
8275
});
8376

0 commit comments

Comments
 (0)