Problem
The root npm run verify includes desktop/src/**/*.test.* patterns in vitest.config.ts, but CI only runs npm ci in the root directory. Desktop is not in root workspaces (workspaces: ["packages/*"]), so desktop/node_modules is never created in CI.
This means any test that imports from desktop/src/ source files will fail because those files transitively depend on Desktop-only packages (lucide-react, @tauri-apps/api, react-markdown, rehype-katex, etc.) that don't exist in root node_modules.
The current workaround (PR #1443) uses vi.mock() for local module boundaries (./CommandPalette, ./Markdown, ./cards) and resolve.alias in vitest.config.ts for external deps. This works but is a testing infrastructure debt.
Why this matters
- Mocking local modules is a test smell; tests should ideally load real source code
- The alias + mock approach requires maintaining a growing list of Desktop-only dependencies in
tests/mocks/
- Every new test that imports from
desktop/src/ risks hitting a new "missing module" failure in CI
desktop/package.json uses workspace:* for @reasonix/core-utils, which npm install in the Desktop directory cannot resolve (Desktop is not a workspace member)
Options
Option A: Extract pure-logic modules
Move reduce/applyIncoming from App.tsx to App.state.ts, and approval cards from thread.tsx to approval-cards.tsx, so tests import files with no Desktop-only transitive deps.
Option B: Install Desktop deps in CI
Update .github/workflows/ci.yml to also install Desktop dependencies. Requires handling workspace:* protocol (e.g., temporarily replacing with file: path or symlinking @reasonix/core-utils before npm install).
Option C: Remove Desktop tests from root runner
Give Desktop its own vitest.config.ts and test script, run separately in CI. Requires Desktop to have its own node_modules installed.
Recommendation
Option A (extract pure logic) is the cleanest long-term fix. The reduce function and State/Action types in App.tsx are already pure functions with no UI dependencies — they just happen to live in a file that imports Tauri APIs. Extracting them aligns with Redux/Flux patterns and eliminates the need for any mocks in reducer tests.
Option B is acceptable if we want to keep the current file structure, but it introduces CI complexity around workspace:* resolution.
Problem
The root
npm run verifyincludesdesktop/src/**/*.test.*patterns invitest.config.ts, but CI only runsnpm ciin the root directory. Desktop is not in root workspaces (workspaces: ["packages/*"]), sodesktop/node_modulesis never created in CI.This means any test that imports from
desktop/src/source files will fail because those files transitively depend on Desktop-only packages (lucide-react,@tauri-apps/api,react-markdown,rehype-katex, etc.) that don't exist in rootnode_modules.The current workaround (PR #1443) uses
vi.mock()for local module boundaries (./CommandPalette,./Markdown,./cards) andresolve.aliasinvitest.config.tsfor external deps. This works but is a testing infrastructure debt.Why this matters
tests/mocks/desktop/src/risks hitting a new "missing module" failure in CIdesktop/package.jsonusesworkspace:*for@reasonix/core-utils, whichnpm installin the Desktop directory cannot resolve (Desktop is not a workspace member)Options
Option A: Extract pure-logic modules
Move
reduce/applyIncomingfromApp.tsxtoApp.state.ts, and approval cards fromthread.tsxtoapproval-cards.tsx, so tests import files with no Desktop-only transitive deps.Option B: Install Desktop deps in CI
Update
.github/workflows/ci.ymlto also install Desktop dependencies. Requires handlingworkspace:*protocol (e.g., temporarily replacing withfile:path or symlinking@reasonix/core-utilsbeforenpm install).Option C: Remove Desktop tests from root runner
Give Desktop its own
vitest.config.tsand test script, run separately in CI. Requires Desktop to have its own node_modules installed.Recommendation
Option A (extract pure logic) is the cleanest long-term fix. The
reducefunction andState/Actiontypes inApp.tsxare already pure functions with no UI dependencies — they just happen to live in a file that imports Tauri APIs. Extracting them aligns with Redux/Flux patterns and eliminates the need for any mocks in reducer tests.Option B is acceptable if we want to keep the current file structure, but it introduces CI complexity around
workspace:*resolution.