chore(test/server): always initialize translations

This commit is contained in:
Elian Doran
2025-04-28 17:30:58 +03:00
parent 6e4698cf61
commit 43876deefc
6 changed files with 21 additions and 8 deletions

20
apps/server/spec/setup.ts Normal file
View File

@@ -0,0 +1,20 @@
import { beforeAll } from "vitest";
import { getResourceDir } from "../src/services/utils.js";
import i18next from "i18next";
import { join } from "path";
beforeAll(async () => {
// Initialize the translations manually to avoid any side effects.
const resourceDir = getResourceDir();
const Backend = (await import("i18next-fs-backend")).default;
// Initialize translations
await i18next.use(Backend).init({
lng: "en",
fallbackLng: "en",
ns: "server",
backend: {
loadPath: join(resourceDir, "assets/translations/{{lng}}/{{ns}}.json")
}
});
});