Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/nuxt/src/runtime/utils.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
}
}
Expand Down
10 changes: 7 additions & 3 deletions packages/nuxt/test/runtime/plugins/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
Loading