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.
This commit is contained in:
Dominic Cooney
2026-05-29 11:57:47 -07:00
parent 9ea8dcf3b7
commit f16d49e3ef
+33
View File
@@ -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<string, unknown> = {}) => ({
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()