Separates control of OTEL telemetry and anonymous PostHog telemetry: - CONTINUE_CLI_ENABLE_TELEMETRY: Controls OTEL telemetry (requires OTEL config) - CONTINUE_ALLOW_ANONYMOUS_TELEMETRY: Controls anonymous PostHog telemetry This allows users to independently control: 1. OTEL metrics (opt-in via config + env var) 2. Anonymous telemetry (opt-out via env var) Changes: - Added CONTINUE_ALLOW_ANONYMOUS_TELEMETRY env var - Updated posthogService to use new env var - Kept CONTINUE_CLI_ENABLE_TELEMETRY for OTEL control - Updated documentation for both telemetry types - Updated all tests to reflect the change Generated with [Continue](https://continue.dev) Co-authored-by: tingwai <tingwai@continue.dev>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { vi } from "vitest";
|
|
|
|
import { resetConsoleOverrides } from "./src/init.js";
|
|
|
|
// Disable telemetry for tests
|
|
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
|
|
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";
|
|
|
|
// Mock the 'open' package to prevent browser opening during tests
|
|
vi.mock("open", () => ({
|
|
default: vi.fn().mockResolvedValue(undefined),
|
|
}));
|
|
|
|
// Mock constructSystemMessage to avoid service container issues in tests
|
|
vi.mock("./src/systemMessage.js", () => ({
|
|
constructSystemMessage: vi
|
|
.fn()
|
|
.mockResolvedValue(
|
|
"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.",
|
|
),
|
|
}));
|
|
|
|
// Mock environment for tests
|
|
process.env.CONTINUE_GLOBAL_DIR = "/tmp/continue-test";
|
|
|
|
// Set up global afterEach hook to clear all timers and reset console
|
|
afterEach(() => {
|
|
// Clear vitest timers
|
|
vi.clearAllTimers();
|
|
|
|
// Reset console overrides to ensure clean state for each test
|
|
try {
|
|
resetConsoleOverrides();
|
|
} catch {
|
|
// Ignore errors when resetting console
|
|
}
|
|
});
|