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>
This commit is contained in:
Nate 2026-02-18 13:03:03 -08:00
parent 9ce8788b77
commit 175c95b49d

View file

@ -1,3 +1,4 @@
import path from "path";
import { defineConfig } from "vitest/config";
export default defineConfig({
@ -22,6 +23,9 @@ export default defineConfig({
hookTimeout: 30000,
},
resolve: {
alias: {
src: path.resolve(__dirname, "src"),
},
extensions: [".js", ".ts", ".tsx", ".json"],
},
});