Files
zerobyte/app/test/setup-shared.ts
Nico 4305057185 test: move test runner from Bun to Vitest (#727)
* chore: migrate to vitest

* test: speed up some suites by sharing sessions and mocking expensive non-tested actions

* test: refactor some tests to verify behavior instead of implementation details

* chore: fix linting issues
2026-04-01 20:05:54 +02:00

33 lines
833 B
TypeScript

import { vi } from "vitest";
process.env.BASE_URL = "http://localhost:3000";
process.env.TRUSTED_ORIGINS = "http://localhost:3000";
vi.mock(import("@zerobyte/core/node"), async () => {
const utils = await vi.importActual<typeof import("@zerobyte/core/node")>("@zerobyte/core/node");
return {
...utils,
logger: {
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
},
};
});
vi.mock(import("~/server/utils/crypto"), async () => {
const cryptoModule = await vi.importActual<typeof import("~/server/utils/crypto")>("~/server/utils/crypto");
return {
cryptoUtils: {
...cryptoModule.cryptoUtils,
deriveSecret: async () => "test-secret",
sealSecret: async (v: string) => v,
resolveSecret: async (v: string) => v,
generateResticPassword: () => "test-restic-password",
},
};
});