File tree Expand file tree Collapse file tree 3 files changed +13
-21
lines changed Expand file tree Collapse file tree 3 files changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ module.exports = [
193193 import : createImport ( 'init' ) ,
194194 ignore : [ 'next/router' , 'next/constants' ] ,
195195 gzip : true ,
196- limit : '38.03 KB' ,
196+ limit : '38.05 KB' ,
197197 } ,
198198 // SvelteKit SDK (ESM)
199199 {
Original file line number Diff line number Diff line change 1- import { addEventProcessor , applySdkMetadata , hasTracingEnabled } from '@sentry/core' ;
1+ import { addEventProcessor , applySdkMetadata } from '@sentry/core' ;
22import type { BrowserOptions } from '@sentry/react' ;
33import { getDefaultIntegrations as getReactDefaultIntegrations , init as reactInit } from '@sentry/react' ;
44import type { Client , EventProcessor , Integration } from '@sentry/types' ;
@@ -48,13 +48,10 @@ export function init(options: BrowserOptions): Client | undefined {
4848
4949function getDefaultIntegrations ( options : BrowserOptions ) : Integration [ ] {
5050 const customDefaultIntegrations = getReactDefaultIntegrations ( options ) ;
51-
52- // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
53- // will get treeshaken away
51+ // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false",
52+ // in which case everything inside will get tree-shaken away
5453 if ( typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__ ) {
55- if ( hasTracingEnabled ( options ) ) {
56- customDefaultIntegrations . push ( browserTracingIntegration ( ) ) ;
57- }
54+ customDefaultIntegrations . push ( browserTracingIntegration ( ) ) ;
5855 }
5956
6057 // This value is injected at build time, based on the output directory specified in the build config. Though a default
Original file line number Diff line number Diff line change @@ -130,33 +130,28 @@ describe('Client init()', () => {
130130 } ) ;
131131
132132 describe ( 'browserTracingIntegration()' , ( ) => {
133- it ( 'adds ` browserTracingIntegration()` integration if `tracesSampleRate ` is set' , ( ) => {
133+ it ( 'adds the browserTracingIntegration when `__SENTRY_TRACING__ ` is not set' , ( ) => {
134134 const client = init ( {
135135 dsn : TEST_DSN ,
136- tracesSampleRate : 1.0 ,
137136 } ) ;
138137
139138 const browserTracingIntegration = client ?. getIntegrationByName ( 'BrowserTracing' ) ;
140- expect ( browserTracingIntegration ?. name ) . toBe ( 'BrowserTracing' ) ;
139+ expect ( browserTracingIntegration ) . toBeDefined ( ) ;
141140 } ) ;
142141
143- it ( 'adds `browserTracingIntegration()` integration if `tracesSampler` is set' , ( ) => {
144- const client = init ( {
145- dsn : TEST_DSN ,
146- tracesSampler : ( ) => true ,
147- } ) ;
142+ it ( "doesn't add a browserTracingIntegration if `__SENTRY_TRACING__` is set to false" , ( ) => {
143+ // @ts -expect-error Test setup for build-time flag
144+ globalThis . __SENTRY_TRACING__ = false ;
148145
149- const browserTracingIntegration = client ?. getIntegrationByName ( 'BrowserTracing' ) ;
150- expect ( browserTracingIntegration ?. name ) . toBe ( 'BrowserTracing' ) ;
151- } ) ;
152-
153- it ( 'does not add `browserTracingIntegration()` integration if tracing not enabled in SDK' , ( ) => {
154146 const client = init ( {
155147 dsn : TEST_DSN ,
156148 } ) ;
157149
158150 const browserTracingIntegration = client ?. getIntegrationByName ( 'BrowserTracing' ) ;
159151 expect ( browserTracingIntegration ) . toBeUndefined ( ) ;
152+
153+ // @ts -expect-error Test setup for build-time flag
154+ delete globalThis . __SENTRY_TRACING__ ;
160155 } ) ;
161156 } ) ;
162157 } ) ;
You can’t perform that action at this time.
0 commit comments