Files
stack/apps/api/vitest.config.ts
Jason Woltje ba54de88fd
Some checks failed
ci/woodpecker/push/api Pipeline failed
fix(#410): use toNodeHandler for BetterAuth Express compatibility
BetterAuth expects Web API Request objects (Fetch API standard) with
headers.get(), but NestJS/Express passes IncomingMessage objects with
headers[] property access. Use better-auth/node's toNodeHandler to
properly convert between Express req/res and BetterAuth's Web API handler.

Also fixes vitest SWC config to read the correct tsconfig for NestJS
decorator metadata emission, which was causing DI injection failures
in tests.

Fixes #410

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:06:49 -06:00

33 lines
704 B
TypeScript

import swc from "unplugin-swc";
import { defineConfig } from "vitest/config";
import path from "path";
export default defineConfig({
test: {
globals: false,
environment: "node",
include: ["src/**/*.test.ts", "src/**/*.spec.ts"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
exclude: ["node_modules/", "dist/"],
},
setupFiles: ["./vitest.setup.ts"],
server: {
deps: {
inline: ["@nestjs/common", "@nestjs/core"],
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
plugins: [
swc.vite({
tsconfigFile: path.resolve(__dirname, "tsconfig.json"),
}),
],
});