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 = [
193
193
import : createImport ( 'init' ) ,
194
194
ignore : [ 'next/router' , 'next/constants' ] ,
195
195
gzip : true ,
196
- limit : '38.03 KB' ,
196
+ limit : '38.05 KB' ,
197
197
} ,
198
198
// SvelteKit SDK (ESM)
199
199
{
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' ;
2
2
import type { BrowserOptions } from '@sentry/react' ;
3
3
import { getDefaultIntegrations as getReactDefaultIntegrations , init as reactInit } from '@sentry/react' ;
4
4
import type { Client , EventProcessor , Integration } from '@sentry/types' ;
@@ -48,13 +48,10 @@ export function init(options: BrowserOptions): Client | undefined {
48
48
49
49
function getDefaultIntegrations ( options : BrowserOptions ) : Integration [ ] {
50
50
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
54
53
if ( typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__ ) {
55
- if ( hasTracingEnabled ( options ) ) {
56
- customDefaultIntegrations . push ( browserTracingIntegration ( ) ) ;
57
- }
54
+ customDefaultIntegrations . push ( browserTracingIntegration ( ) ) ;
58
55
}
59
56
60
57
// 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()', () => {
130
130
} ) ;
131
131
132
132
describe ( 'browserTracingIntegration()' , ( ) => {
133
- it ( 'adds ` browserTracingIntegration()` integration if `tracesSampleRate ` is set' , ( ) => {
133
+ it ( 'adds the browserTracingIntegration when `__SENTRY_TRACING__ ` is not set' , ( ) => {
134
134
const client = init ( {
135
135
dsn : TEST_DSN ,
136
- tracesSampleRate : 1.0 ,
137
136
} ) ;
138
137
139
138
const browserTracingIntegration = client ?. getIntegrationByName ( 'BrowserTracing' ) ;
140
- expect ( browserTracingIntegration ?. name ) . toBe ( 'BrowserTracing' ) ;
139
+ expect ( browserTracingIntegration ) . toBeDefined ( ) ;
141
140
} ) ;
142
141
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 ;
148
145
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' , ( ) => {
154
146
const client = init ( {
155
147
dsn : TEST_DSN ,
156
148
} ) ;
157
149
158
150
const browserTracingIntegration = client ?. getIntegrationByName ( 'BrowserTracing' ) ;
159
151
expect ( browserTracingIntegration ) . toBeUndefined ( ) ;
152
+
153
+ // @ts -expect-error Test setup for build-time flag
154
+ delete globalThis . __SENTRY_TRACING__ ;
160
155
} ) ;
161
156
} ) ;
162
157
} ) ;
You can’t perform that action at this time.
0 commit comments