From f16d49e3ef7201a7101e836b2511e58f2ab2cdb3 Mon Sep 17 00:00:00 2001 From: Dominic Cooney Date: Tue, 26 May 2026 14:11:39 -0700 Subject: [PATCH] fix(test): stub telemetry helpers in unit-test @cline/core mock Mirror the integration-test fix from bf147b939 in apps/vscode/src/test/requires.ts so the unit-test @cline/core mock also exposes `createClineTelemetryServiceConfig` and `createConfiguredTelemetryHandle`. Currently only marketplace-filtering.test.ts constructs a Controller, but any future unit test that does so would hit the same `TypeError: createClineTelemetryServiceConfig is not a function` and these two shims should stay in sync. --- apps/vscode/src/test/requires.ts | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/apps/vscode/src/test/requires.ts b/apps/vscode/src/test/requires.ts index 8b705e3917..a0a0017548 100644 --- a/apps/vscode/src/test/requires.ts +++ b/apps/vscode/src/test/requires.ts @@ -20,6 +20,22 @@ Module.prototype.require = function (path: string) { // so requiring SDK adapter modules would otherwise make Mocha fall back to native // ESM loading and bypass tsconfig-paths aliases such as @shared/*. if (path === "@cline/core") { + const createNoopTelemetry = () => ({ + setDistinctId() {}, + setMetadata() {}, + updateMetadata() {}, + setCommonProperties() {}, + updateCommonProperties() {}, + isEnabled: () => false, + capture() {}, + captureRequired() {}, + recordCounter() {}, + recordHistogram() {}, + recordGauge() {}, + flush: async () => {}, + dispose: async () => {}, + }) + class ProviderSettingsManager { private state = { providers: {}, lastUsedProvider: undefined } @@ -41,6 +57,23 @@ Module.prototype.require = function (path: string) { } return { + createClineTelemetryServiceConfig: (config: Record = {}) => ({ + enabled: false, + metadata: { + extension_version: "test", + cline_type: "test", + platform: "test", + platform_version: "test", + os_type: "test", + os_version: "test", + }, + ...config, + }), + createConfiguredTelemetryHandle: () => ({ + telemetry: createNoopTelemetry(), + flush: async () => {}, + dispose: async () => {}, + }), ClineCore: class { static async create() { return new this()