-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Project:
- ide
Description:
- The isolated Vitest suite for
src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsxfails before any tests run because its@/utils/workspacemock omitsgetProjectPath. SDKContextcallsgetProjectPath()during initialization, so the suite crashes at import/setup time with0 testexecuted.- This also contributes to
npm run testfailing onmainbecause the broken suite aborts the run.
Error Message:
[vitest] No "getProjectPath" export is defined on the "@/utils/workspace" mock. Did you forget to return it from "vi.mock"?
Debug Logs:
- Repro command:
npm.cmd run test -- src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsx- Relevant excerpt:
> cortex-desktop@0.1.0 test
> vitest run src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsx
FAIL src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsx
Error: [vitest] No "getProjectPath" export is defined on the "@/utils/workspace" mock.
? getInitialCwd src/context/SDKContext.tsx:141:12
System Information:
- OS: Microsoft Windows 11 Pro (10.0.26200)
- CPU/RAM: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz, 15.78 GB RAM
- GPU (if relevant): Intel(R) UHD Graphics 620 (Driver 31.0.101.2137)
- Node version: v24.14.0
- npm version: 11.9.0
- Rust version: N/A on tested machine (
rustcnot on PATH; not required for repro) - App version: 0.1.0 (package.json), 0.1.0 (src-tauri/tauri.conf.json)
- Git commit short SHA: c2037f2
Screenshots:
- Evidence type: Screenshot(s)
- What to capture:
- Terminal output showing the isolated Vitest suite failing with the missing
getProjectPathmock export. - Source evidence showing the incomplete mock in
cov-CortexDiffEditor.test.tsx, the realgetProjectPathexport inworkspace.ts, and the call site inSDKContext.tsx. - How to capture (include OS steps):
- Windows:
Win+Shift+Sfor screenshots,Win+Alt+Rfor video. - macOS:
Shift+Cmd+4for screenshots,Shift+Cmd+5for video. - Linux:
PrtSc/Shift+PrtScfor screenshots,Ctrl+Alt+Shift+Ror OBS for video. - When to capture:
- At step 4 when the Vitest error is visible.
- At step 5 when the source lines are visible.
- Attach instructions:
- Embedded below from a public evidence repo owned by the reporting account.
- Terminal evidence:

- Code evidence:

Steps to Reproduce:
git clone https://github.com/CortexLM/cortex-ide.gitcd cortex-idenpm.cmd ci- Run
npm.cmd run test -- src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsx - Observe the suite fails before running tests because the mocked
@/utils/workspacemodule does not providegetProjectPath.
Expected Behavior:
- The isolated
cov-CortexDiffEditorsuite should load and execute its tests without import-time mock errors.
Actual Behavior:
- The suite aborts at import/setup time with
0 testexecuted becauseSDKContextreachesgetProjectPath()and the mocked module does not export it.
Additional Context:
- Frequency: Always on the tested commit.
- Workarounds: Local-only fix by adding
getProjectPathto the test mock or partially mocking@/utils/workspacewithimportOriginal. - Suspected cause + file(s)/component(s):
src/components/cortex/editor/__tests__/cov-CortexDiffEditor.test.tsx:5src/utils/workspace.ts:20src/context/SDKContext.tsx:141- Duplicate check: repo issue searches for
cov-CortexDiffEditor.test.tsx getProjectPath,No getProjectPath export workspace mock, andvitest workspace mock getProjectPathreturned no matches before filing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels