continue-custom/extensions/cli/vitest.config.ts
Nate 175c95b49d fix: add src path alias to vitest config for module resolution
The tsconfig uses baseUrl: "." which allows imports like "src/..." to
resolve correctly for tsc, but vitest doesn't read tsconfig paths by
default. This adds a resolve.alias to map "src" to the actual source
directory so tests can resolve these imports.

Fixes ToolPermissionService test failures (TypeError: ToolPermissionService
is not a constructor) caused by failed module resolution of "src/..." paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 13:03:03 -08:00

31 lines
721 B
TypeScript

import path from "path";
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
environment: "node",
setupFiles: ["./vitest.setup.ts"],
exclude: ["**/node_modules/**", "**/dist/**", "**/*.e2e.*", "**/e2e/**"],
coverage: {
reporter: ["text", "json", "html"],
exclude: [
"node_modules/",
"dist/",
"**/*.test.ts",
"**/*.spec.ts",
"**/test-helpers/**",
"**/types/**",
"**/__mocks__/**",
],
},
testTimeout: 30000,
hookTimeout: 30000,
},
resolve: {
alias: {
src: path.resolve(__dirname, "src"),
},
extensions: [".js", ".ts", ".tsx", ".json"],
},
});