Skip to content

test(cli,lsp): make tests runnable without a prior build#86

Merged
oratis merged 1 commit into
mainfrom
claude/agitated-cannon-769b38
May 29, 2026
Merged

test(cli,lsp): make tests runnable without a prior build#86
oratis merged 1 commit into
mainfrom
claude/agitated-cannon-769b38

Conversation

@oratis

@oratis oratis commented May 29, 2026

Copy link
Copy Markdown
Owner

What

Adds a vitest.config.ts to apps/cli and apps/lsp, each aliasing the bare @deepcode/core specifier to core's source entry (packages/core/src/index.ts) — mirroring what apps/desktop/vite.config.ts already does.

Why

From a clean checkout, pnpm -r test (and pnpm --filter deepcode-cli test / --filter @deepcode/lsp test on their own) failed:

Error: Failed to resolve entry for package "@deepcode/core".
The package may have incorrect main/module/exports specified in its package.json.

Both apps import @deepcode/core, whose package main points at ./dist. Vitest extends Vite, which resolves that bare specifier to the unbuilt dist at transform time. It only worked in CI because pnpm typecheck (tsc -b, which emits) runs before pnpm test, so dist/ happened to exist — a build-order footgun for anyone running the tests directly.

Aliasing to source makes the tests self-contained (no prior build needed) and faster, and is consistent with the desktop renderer's existing setup.

Verification

From a fully clean state (rm -rf all dist/):

  • pnpm -r testexit 0 (core 501✓/10↓, cli 59✓, lsp 8✓, desktop 24✓, vscode no-tests)
  • pnpm typecheck → exit 0
  • pnpm lint → exit 0 (3 pre-existing warnings, none from this change)
  • pnpm format:check → exit 0

Before this change, cli and lsp test steps both errored on clean main.

Note on the original Tailwind report

This branch was opened to add tailwindcss to apps/desktop (PostCSS config referenced a missing tailwindcss plugin). While working, I found main had already resolved that exact failure in #83 by deleting the dead postcss.config.js / tailwind.config.ts (Tailwind was never actually used — index.css is hand-written, no @tailwind directives). So no desktop change is needed; re-adding the dependency would reintroduce the dead config. This PR contains only the still-open cli/lsp build-order fix found along the way.

🤖 Generated with Claude Code

…build

`pnpm -r test` (and `pnpm --filter` on cli/lsp alone) failed from a clean
checkout with:

    Error: Failed to resolve entry for package "@deepcode/core".
    The package may have incorrect main/module/exports specified...

Both apps import @deepcode/core, whose package "main" points at ./dist.
Vitest extends Vite, which resolves that bare specifier to the (unbuilt)
dist at transform time. It only worked in CI because `pnpm typecheck`
(`tsc -b`, which emits) runs before `pnpm test`, so dist happened to exist
— a build-order footgun for anyone running tests directly.

Add a vitest.config.ts to each app aliasing `@deepcode/core` to its source
entry, mirroring apps/desktop/vite.config.ts. Tests now run against source,
are self-contained, and need no prior build. Verified `pnpm -r test` passes
from a fully clean (no dist) state; typecheck/lint/format unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oratis oratis merged commit 5304f75 into main May 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant