diff --git a/panel/src/i18n/language.test.ts b/panel/src/i18n/language.test.ts index a7abf5b..fd04c38 100644 --- a/panel/src/i18n/language.test.ts +++ b/panel/src/i18n/language.test.ts @@ -1,5 +1,5 @@ // @vitest-environment jsdom -import { describe, it, expect, vi, afterEach } from "vitest"; +import { describe, it, expect, vi, afterEach, beforeEach } from "vitest"; import i18next from "i18next"; import LanguageDetector from "i18next-browser-languagedetector"; import { i18nOptions } from "./index"; @@ -15,6 +15,13 @@ async function boot(languages: string[]) { return instance; } +// Importing ./index boots the app's own instance, which on some Node versions (22, +// which CI runs) caches jsdom's en-US in storage before the first test; a first +// visit starts from empty storage, and no test may inherit another's choice. +beforeEach(() => { + localStorage.clear(); +}); + afterEach(() => { vi.restoreAllMocks(); });