mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 03:46:37 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			938 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			938 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { beforeAll } from "vitest";
 | 
						|
import i18next from "i18next";
 | 
						|
import { join } from "path";
 | 
						|
import dayjs from "dayjs";
 | 
						|
 | 
						|
// Initialize environment variables.
 | 
						|
process.env.TRILIUM_DATA_DIR = join(__dirname, "db");
 | 
						|
process.env.TRILIUM_RESOURCE_DIR = join(__dirname, "../src");
 | 
						|
process.env.TRILIUM_INTEGRATION_TEST = "memory";
 | 
						|
process.env.TRILIUM_ENV = "dev";
 | 
						|
process.env.TRILIUM_PUBLIC_SERVER = "http://localhost:4200";
 | 
						|
 | 
						|
beforeAll(async () => {
 | 
						|
    // Initialize the translations manually to avoid any side effects.
 | 
						|
    const Backend = (await import("i18next-fs-backend")).default;
 | 
						|
 | 
						|
    // Initialize translations
 | 
						|
    await i18next.use(Backend).init({
 | 
						|
        lng: "en",
 | 
						|
        fallbackLng: "en",
 | 
						|
        ns: "server",
 | 
						|
        backend: {
 | 
						|
            loadPath: join(__dirname, "../src/assets/translations/{{lng}}/{{ns}}.json")
 | 
						|
        }
 | 
						|
    });
 | 
						|
 | 
						|
    // Initialize dayjs
 | 
						|
    await import("dayjs/locale/en.js");
 | 
						|
    dayjs.locale("en");
 | 
						|
});
 |