Skip to content

Build your personal knowledge base with Trilium Notes

chore(test/server): fix some initialization errors

Elian Doran6e4698cf61ac
diff --git a/apps/server/src/routes/login.spec.ts b/apps/server/src/routes/login.spec.ts
index 31abf725d4..1c921168a4 100644
--- a/apps/server/src/routes/login.spec.ts
+++ b/apps/server/src/routes/login.spec.ts
@@ -3,7 +3,6 @@ import supertest from "supertest";
import { initializeTranslations } from "../services/i18n.js";
import type { Application } from "express";
import dayjs from "dayjs";
-import buildApp from "../app.js";
let app: Application;
@@ -11,6 +10,7 @@ describe("Login Route test", () => {
beforeAll(async () => {
initializeTranslations();
+ const buildApp = (await import("../app.js")).default;
app = await buildApp();
});
diff --git a/apps/server/src/services/migration.spec.ts b/apps/server/src/services/migration.spec.ts
index 5a96cae7bb..321d9418d0 100644
--- a/apps/server/src/services/migration.spec.ts
+++ b/apps/server/src/services/migration.spec.ts
@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";
-import becca from "../becca/becca.js";
import sql from "./sql.js";
import migration from "./migration.js";
import cls from "./cls.js";
diff --git a/apps/server/src/share/routes.spec.ts b/apps/server/src/share/routes.spec.ts
index de2f50fcc5..8c8567f324 100644
--- a/apps/server/src/share/routes.spec.ts
+++ b/apps/server/src/share/routes.spec.ts
@@ -3,7 +3,6 @@ import supertest from "supertest";
import { initializeTranslations } from "../services/i18n.js";
import type { Application, Request, Response, NextFunction } from "express";
import { safeExtractMessageAndStackFromError } from "../services/utils.js";
-import buildApp from "../app.js";
let app: Application;
@@ -12,6 +11,7 @@ describe("Share API test", () => {
beforeAll(async () => {
initializeTranslations();
+ const buildApp = (await import("../app.js")).default;
app = await buildApp();
app.use((err: unknown, req: Request, res: Response, next: NextFunction) => {
const [ errMessage ] = safeExtractMessageAndStackFromError(err);