diff --git a/jest.config.js b/jest.config.js index 9a8334ac3b..0e2d002a9d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,10 +18,10 @@ module.exports = { lines: 84, }, 'packages/cli/': { - statements: 64, + statements: 63, branches: 51, - functions: 63, - lines: 64, + functions: 62, + lines: 63, }, 'packages/respect-core/': { statements: 79, diff --git a/packages/cli/src/utils/miscellaneous.ts b/packages/cli/src/utils/miscellaneous.ts index 8932014bc5..a5ba699585 100644 --- a/packages/cli/src/utils/miscellaneous.ts +++ b/packages/cli/src/utils/miscellaneous.ts @@ -29,9 +29,7 @@ import { deprecatedRefDocsSchema } from '@redocly/config/lib/reference-docs-conf import { outputExtensions } from '../types'; import { version } from './update-version-notifier'; import { DESTINATION_REGEX } from '../commands/push'; -import { RedoclyOAuthClient } from '../auth/oauth-client'; import { getReuniteUrl } from '../reunite/api'; -import { otelTelemetry } from '../otel'; import type { Arguments } from 'yargs'; import type { @@ -549,8 +547,6 @@ export function cleanColors(input: string): string { return input.replace(/\x1b\[\d+m/g, ''); } -otelTelemetry.init(); - export async function sendTelemetry( argv: Arguments | undefined, exit_code: ExitCode, @@ -570,6 +566,7 @@ export async function sendTelemetry( } = argv; const event_time = new Date().toISOString(); const redoclyClient = new RedoclyClient(); + const { RedoclyOAuthClient } = await import('../auth/oauth-client'); const oauthClient = new RedoclyOAuthClient('redocly-cli', version); const reuniteUrl = getReuniteUrl(argv.residency as string | undefined); const logged_in = redoclyClient.hasTokens() || (await oauthClient.isAuthorized(reuniteUrl)); @@ -592,6 +589,8 @@ export async function sendTelemetry( spec_keyword, spec_full_version, }; + const { otelTelemetry } = await import('../otel'); + otelTelemetry.init(); otelTelemetry.send(data.command, data); } catch (err) { // Do nothing.