Skip to content

Commit ebcb23d

Browse files
committed
fix: add missing Uri and RelativePattern exports to VSCode mock in MCP tests
- Added Uri.file mock function to return proper Uri-like objects - Added RelativePattern mock constructor - Fixes test failures where McpHub.ts uses vscode.Uri.file() and vscode.RelativePattern - All MCP tests now pass (24/24)
1 parent 36ff031 commit ebcb23d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/services/mcp/__tests__/McpHub.spec.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ vi.mock("vscode", () => ({
6262
dispose: vi.fn(),
6363
}),
6464
},
65+
Uri: {
66+
file: vi.fn((path: string) => ({
67+
scheme: "file",
68+
authority: "",
69+
path: path,
70+
query: "",
71+
fragment: "",
72+
fsPath: path,
73+
with: vi.fn(),
74+
toJSON: vi.fn(),
75+
})),
76+
},
77+
RelativePattern: vi.fn().mockImplementation((base: string, pattern: string) => ({
78+
base,
79+
pattern,
80+
})),
6581
Disposable: {
6682
from: vi.fn(),
6783
},
@@ -93,7 +109,6 @@ describe("McpHub", () => {
93109
// Mock console.error to suppress error messages during tests
94110
console.error = vi.fn()
95111

96-
97112
const mockUri: Uri = {
98113
scheme: "file",
99114
authority: "",

0 commit comments

Comments
 (0)