andy-stack_vaultkeeper-ai/vitest.config.ts
Andrew Beal a4daa3a9df refactor: update tests for AIFunctionService and path alias changes
- Remove AIFunctionDefinitions mock from AI class tests
- Update IPrompt import path to AIPrompts directory
- Remove deprecated streamRequest boolean parameter
- Fix error handling assertions in AIFunctionService tests
- Remove ChatService sanitization and assistant message tests
- Add path aliases to tsconfig and vitest config
2025-12-30 21:58:54 +00:00

81 lines
2 KiB
TypeScript

import { defineConfig } from "vitest/config";
import * as path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [],
resolve: {
alias: {
"obsidian": path.resolve(__dirname, "__mocks__/obsidian.ts"),
// Support TypeScript path mapping from tsconfig
"Helpers": path.resolve(__dirname, "Helpers"),
"Enums": path.resolve(__dirname, "Enums"),
"Services": path.resolve(__dirname, "Services"),
"Conversations": path.resolve(__dirname, "Conversations"),
"AIClasses": path.resolve(__dirname, "AIClasses"),
"AIPrompts": path.resolve(__dirname, "AIPrompts"),
"Components": path.resolve(__dirname, "Components"),
"Stores": path.resolve(__dirname, "Stores"),
"Views": path.resolve(__dirname, "Views"),
"Modals": path.resolve(__dirname, "Modals"),
"Types": path.resolve(__dirname, "Types")
}
},
test: {
// Use happy-dom for faster DOM simulation
environment: "happy-dom",
// Test file patterns
include: ["__tests__/**/*.{test,spec}.{js,ts}"],
// Setup files to run before each test file
setupFiles: ["__tests__/setup.ts"],
// Coverage configuration
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: [
"Services/**/*.ts",
"AIClasses/**/*.ts",
"Helpers/**/*.ts",
"Conversations/**/*.ts",
"Components/**/*.svelte",
"Enums/**/*.ts",
"Stores/**/*.ts"
],
exclude: [
"**/*.test.ts",
"**/*.spec.ts",
"node_modules/**",
"__tests__/**",
"main.ts",
"Views/**",
"Modals/**"
],
thresholds: {
lines: 70,
functions: 70,
branches: 65,
statements: 70
}
},
// Global test timeout (10 seconds for most tests)
testTimeout: 10000,
// Enable global test APIs (describe, it, expect, etc.) without imports
globals: true,
// Clear mocks between tests
clearMocks: true,
// Restore mocks between tests
restoreMocks: true,
// Mock reset between tests
mockReset: true
}
});