test(cli,lsp): make tests runnable without a prior build#86
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
vitest.config.tsto apps/cli and apps/lsp, each aliasing the bare@deepcode/corespecifier 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(andpnpm --filter deepcode-cli test/--filter @deepcode/lsp teston their own) failed:Both apps import
@deepcode/core, whose packagemainpoints at./dist. Vitest extends Vite, which resolves that bare specifier to the unbuiltdistat transform time. It only worked in CI becausepnpm typecheck(tsc -b, which emits) runs beforepnpm test, sodist/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 -rfalldist/):pnpm -r test→ exit 0 (core 501✓/10↓, cli 59✓, lsp 8✓, desktop 24✓, vscode no-tests)pnpm typecheck→ exit 0pnpm lint→ exit 0 (3 pre-existing warnings, none from this change)pnpm format:check→ exit 0Before this change, cli and lsp test steps both errored on clean
main.Note on the original Tailwind report
This branch was opened to add
tailwindcsstoapps/desktop(PostCSS config referenced a missingtailwindcssplugin). While working, I foundmainhad already resolved that exact failure in #83 by deleting the deadpostcss.config.js/tailwind.config.ts(Tailwind was never actually used —index.cssis hand-written, no@tailwinddirectives). 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