Elffuss BraidHub

kikocis/continue public

b4db4cbf8943 · 955 BRawPermalink
1import { vi } from "vitest";
2
3import { resetConsoleOverrides } from "./src/init.js";
4
5// Disable telemetry for tests
6process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
7
8// Mock the 'open' package to prevent browser opening during tests
9vi.mock("open", () => ({
10 default: vi.fn().mockResolvedValue(undefined),
11}));
12
13// Mock constructSystemMessage to avoid service container issues in tests
14vi.mock("./src/systemMessage.js", () => ({
15 constructSystemMessage: vi
16 .fn()
17 .mockResolvedValue(
18 "You are an agent in the Continue CLI. Given the user's prompt, you should use the tools available to you to answer the user's question.",
19 ),
20}));
21
22// Set up global afterEach hook to clear all timers and reset console
23afterEach(() => {
24 // Clear vitest timers
25 vi.clearAllTimers();
26
27 // Reset console overrides to ensure clean state for each test
28 try {
29 resetConsoleOverrides();
30 } catch {
31 // Ignore errors when resetting console
32 }
33});