- Convert 17 server spec files from vitest to Jest (vi -> jest globals) - Add jest.mock stubs for ESM-only prosemirror/html and collaboration modules - Fix Zod v4 strict UUID validation failures in test fixtures (version byte [1-8] required) - Add JwtAuthGuard.overrideGuard in all controller specs that lacked it - Fix jest.Mock type inference (ReturnType<typeof jest.fn> -> jest.Mock) to prevent 'never' arg errors - Delete vitest.config.ts (CJS), keep vitest.config.mts (ESM-compatible) on client - Add global mocks for @excalidraw/excalidraw and @/main.tsx in client test-setup - Result: client 38/38 suites 313/313 tests, server acadenice 21/21 suites 210/210 tests, 0 TS errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
/**
|
|
* Vitest config for Acadenice server specs (R3.x).
|
|
*
|
|
* Why a separate vitest config alongside Jest:
|
|
* The Docmost upstream test suite uses Jest with ts-jest. The Acadenice R3
|
|
* server specs were written with vitest (vi.fn(), vi.mock(), etc.) to match
|
|
* the client-side test style. Rather than rewrite all specs to Jest, we run
|
|
* acadenice specs with vitest and upstream specs with jest.
|
|
*
|
|
* Run: npx vitest run --config vitest.config.ts
|
|
*/
|
|
import { defineConfig } from "vitest/config";
|
|
import * as path from "path";
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
"@docmost/db": path.resolve(__dirname, "./src/database"),
|
|
"@docmost/transactional": path.resolve(
|
|
__dirname,
|
|
"./src/integrations/transactional",
|
|
),
|
|
"@docmost/ee": path.resolve(__dirname, "./src/ee"),
|
|
},
|
|
},
|
|
test: {
|
|
// Only cover acadenice specs — upstream Docmost tests use Jest
|
|
include: ["src/core/acadenice/**/*.spec.ts", "src/database/migrations/**/*.spec.ts"],
|
|
globals: true,
|
|
environment: "node",
|
|
// Vitest needs to transform ESM-only packages
|
|
server: {
|
|
deps: {
|
|
inline: ["nestjs-kysely"],
|
|
},
|
|
},
|
|
},
|
|
});
|