From 8db1671a6ab1f0c21823547a9722b07085d26a4b Mon Sep 17 00:00:00 2001 From: Pavel Grivachev Date: Fri, 29 Oct 2021 00:47:13 +0300 Subject: [PATCH] disable telemetry in tests --- client/src/TelemetryClient.ts | 4 ++++ client/src/test/runTest.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/TelemetryClient.ts b/client/src/TelemetryClient.ts index c52457c8..576ee8d1 100644 --- a/client/src/TelemetryClient.ts +++ b/client/src/TelemetryClient.ts @@ -19,6 +19,10 @@ export class TelemetryClient { } static activate(context: ExtensionContext): TelemetryReporter { + if (process.env['DBT_LS_DISABLE_TELEMETRY']) { + return null; + } + var extensionPath = path.join(context.extensionPath, 'package.json'); var packageJson = JSON.parse(fs.readFileSync(extensionPath, 'utf8')); diff --git a/client/src/test/runTest.ts b/client/src/test/runTest.ts index 4c706535..779b9f8a 100644 --- a/client/src/test/runTest.ts +++ b/client/src/test/runTest.ts @@ -27,7 +27,7 @@ async function main() { extensionDevelopmentPath, extensionTestsPath, launchArgs: [path.resolve(__dirname, '../../test-fixture/')], - extensionTestsEnv: { CLI_PATH: cliPath }, + extensionTestsEnv: { CLI_PATH: cliPath, DBT_LS_DISABLE_TELEMETRY: 'true' }, }); } catch (err) { console.error('Failed to run tests');