diff --git a/apps/cli/vitest.config.ts b/apps/cli/vitest.config.ts new file mode 100644 index 0000000..6822f21 --- /dev/null +++ b/apps/cli/vitest.config.ts @@ -0,0 +1,22 @@ +// CLI unit tests run in node. They import from @deepcode/core, whose +// package "main" points at ./dist — so without this alias the tests would +// require `@deepcode/core` to be built first (a build-order footgun that +// only works in CI because `pnpm typecheck` runs `tsc -b` and emits dist +// before `pnpm test`). Aliasing the bare specifier to core's source makes +// the tests self-contained and fast, mirroring apps/desktop/vite.config.ts. + +import { defineConfig } from 'vitest/config'; +import { resolve } from 'node:path'; + +export default defineConfig({ + test: { + include: ['src/**/*.test.ts'], + environment: 'node', + globals: true, + }, + resolve: { + alias: { + '@deepcode/core': resolve(__dirname, '..', '..', 'packages', 'core', 'src', 'index.ts'), + }, + }, +}); diff --git a/apps/lsp/vitest.config.ts b/apps/lsp/vitest.config.ts new file mode 100644 index 0000000..c7fec2d --- /dev/null +++ b/apps/lsp/vitest.config.ts @@ -0,0 +1,22 @@ +// LSP unit tests run in node and reach @deepcode/core through handler.ts. +// core's package "main" points at ./dist, so without this alias the tests +// would require core to be built first (a build-order footgun that only +// works in CI because `pnpm typecheck` runs `tsc -b` and emits dist before +// `pnpm test`). Aliasing the bare specifier to core's source keeps the +// tests self-contained, mirroring apps/cli + apps/desktop. + +import { defineConfig } from 'vitest/config'; +import { resolve } from 'node:path'; + +export default defineConfig({ + test: { + include: ['src/**/*.test.ts'], + environment: 'node', + globals: true, + }, + resolve: { + alias: { + '@deepcode/core': resolve(__dirname, '..', '..', 'packages', 'core', 'src', 'index.ts'), + }, + }, +});