diff --git a/packages/nuxt/src/runtime/utils.ts b/packages/nuxt/src/runtime/utils.ts index c6eb59807764..fb247504f78a 100644 --- a/packages/nuxt/src/runtime/utils.ts +++ b/packages/nuxt/src/runtime/utils.ts @@ -1,4 +1,5 @@ import type { ClientOptions, Context } from '@sentry/core'; +import { logger } from '@sentry/core'; import { captureException, getClient, getTraceMetaTags } from '@sentry/core'; import type { VueOptions } from '@sentry/vue/src/types'; import type { CapturedErrorContext } from 'nitropack'; @@ -37,6 +38,7 @@ export function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): v const metaTags = getTraceMetaTags(); if (metaTags) { + logger.log('Adding Sentry tracing meta tags to HTML page:', metaTags); head.push(metaTags); } } diff --git a/packages/nuxt/test/runtime/plugins/server.test.ts b/packages/nuxt/test/runtime/plugins/server.test.ts index 5750f0f9495f..2190e4ed5ef3 100644 --- a/packages/nuxt/test/runtime/plugins/server.test.ts +++ b/packages/nuxt/test/runtime/plugins/server.test.ts @@ -2,9 +2,13 @@ import { getTraceMetaTags } from '@sentry/core'; import { type Mock, afterEach, describe, expect, it, vi } from 'vitest'; import { addSentryTracingMetaTags } from '../../../src/runtime/utils'; -vi.mock('@sentry/core', () => ({ - getTraceMetaTags: vi.fn(), -})); +vi.mock(import('@sentry/core'), async importOriginal => { + const mod = await importOriginal(); + return { + ...mod, + getTraceMetaTags: vi.fn(), + }; +}); describe('addSentryTracingMetaTags', () => { afterEach(() => {