re-init
This commit is contained in:
59
vitest.config.ts
Normal file
59
vitest.config.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
|
||||
setupFiles: ["src/test/setup.ts"],
|
||||
alias: {
|
||||
"@/*": path.resolve(__dirname, "./src/*"),
|
||||
},
|
||||
// Override environment for API integration tests
|
||||
testTimeout: 30000,
|
||||
// Skip external processing for optional ML dependencies
|
||||
server: {
|
||||
deps: {
|
||||
external: ["@tensorflow/tfjs-node", "onnxruntime-node"],
|
||||
},
|
||||
},
|
||||
// Coverage configuration
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
reporter: ["text", "json", "html"],
|
||||
reportsDirectory: "coverage",
|
||||
include: ["src/**/*.{ts,tsx}"],
|
||||
exclude: [
|
||||
"src/**/*.test.{ts,tsx}",
|
||||
"src/test/**/*",
|
||||
"src/**/route.ts",
|
||||
// Pages that are hard to test in isolation (use server features, async params)
|
||||
"src/app/**/*.tsx",
|
||||
"src/app/layout.tsx",
|
||||
"src/app/not-found.tsx",
|
||||
// Database layer - server-only, tested via API routes
|
||||
"src/lib/db.ts",
|
||||
"src/lib/db/**/*",
|
||||
"src/lib/api/diseases-db.ts",
|
||||
// ML backends - mocked in tests
|
||||
"src/lib/ml/model-loader.ts",
|
||||
],
|
||||
thresholds: {
|
||||
lines: 80,
|
||||
statements: 80,
|
||||
branches: 70,
|
||||
functions: 80,
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
// Mock optional ML backends — model-loader falls back to mock mode
|
||||
"@tensorflow/tfjs-node": path.resolve(__dirname, "src/test/mocks/tfjs-node.ts"),
|
||||
"@tensorflow/tfjs": path.resolve(__dirname, "src/test/mocks/tfjs.ts"),
|
||||
"onnxruntime-node": path.resolve(__dirname, "src/test/mocks/onnxruntime-node.ts"),
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user