@@ -67,60 +67,58 @@ describe('Sentry client SDK', () => {
67
67
expect ( browserTracing ) . toBeDefined ( ) ;
68
68
} ) ;
69
69
70
- it ( 'merges the BrowserTracing integration with the user-provided one' , ( ) => { } ) ;
71
- } ) ;
70
+ it . each ( [
71
+ [ 'enableTracing' , { enableTracing : false } ] ,
72
+ [ 'no tracing option set' , { } ] ,
73
+ ] ) ( "doesn't add the BrowserTracing integration if tracing is disabled via %s" , ( _ , tracingOptions ) => {
74
+ init ( {
75
+ dsn :
'https://[email protected] /1337' ,
76
+ ...tracingOptions ,
77
+ } ) ;
78
+
79
+ const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
80
+ const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
72
81
73
- it . each ( [
74
- [ 'enableTracing' , { enableTracing : false } ] ,
75
- [ 'no tracing option set' , { } ] ,
76
- ] ) ( "doesn't add the BrowserTracing integration if tracing is disabled via %s" , ( _ , tracingOptions ) => {
77
- init ( {
78
- dsn :
'https://[email protected] /1337' ,
79
- ...tracingOptions ,
82
+ expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
83
+ expect ( browserTracing ) . toBeUndefined ( ) ;
80
84
} ) ;
81
85
82
- const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
83
- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
86
+ it ( "doesn't add the BrowserTracing integration if `__SENTRY_TRACING__` is set to false" , ( ) => {
87
+ // This is the closest we can get to unit-testing the `__SENTRY_TRACING__` tree-shaking guard
88
+ // IRL, the code to add the integration would most likely be removed by the bundler.
84
89
85
- expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
86
- expect ( browserTracing ) . toBeUndefined ( ) ;
87
- } ) ;
90
+ globalThis . __SENTRY_TRACING__ = false ;
88
91
89
- it ( "doesn't add the BrowserTracing integration if `__SENTRY_TRACING__` is set to false" , ( ) => {
90
- // This is the closest we can get to unit-testing the `__SENTRY_TRACING__` tree-shaking guard
91
- // IRL, the code to add the integration would most likely be removed by the bundler.
92
+ init ( {
93
+ dsn :
'https://[email protected] /1337' ,
94
+ enableTracing : true ,
95
+ } ) ;
92
96
93
- globalThis . __SENTRY_TRACING__ = false ;
97
+ const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
98
+ const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
94
99
95
- init ( {
96
- dsn :
'https://[email protected] /1337' ,
97
- enableTracing : true ,
98
- } ) ;
100
+ expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
101
+ expect ( browserTracing ) . toBeUndefined ( ) ;
99
102
100
- const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
101
- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
103
+ delete globalThis . __SENTRY_TRACING__ ;
104
+ } ) ;
102
105
103
- expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
104
- expect ( browserTracing ) . toBeUndefined ( ) ;
106
+ // TODO: this test is only meaningful once we have a routing instrumentation which we always want to add
107
+ // to a user-provided BrowserTracing integration (see NextJS SDK)
108
+ it . skip ( 'Merges the user-provided BrowserTracing integration with the automatically added one' , ( ) => {
109
+ init ( {
110
+ dsn :
'https://[email protected] /1337' ,
111
+ integrations : [ new BrowserTracing ( { tracePropagationTargets : [ 'myDomain.com' ] } ) ] ,
112
+ enableTracing : true ,
113
+ } ) ;
105
114
106
- delete globalThis . __SENTRY_TRACING__ ;
107
- } ) ;
115
+ const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
116
+ const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
108
117
109
- // TODO: this test is only meaningful once we have a routing instrumentation which we always want to add
110
- // to a user-provided BrowserTracing integration (see NextJS SDK)
111
- it . skip ( 'Merges the user-provided BrowserTracing integration with the automatically added one' , ( ) => {
112
- init ( {
113
- dsn :
'https://[email protected] /1337' ,
114
- integrations : [ new BrowserTracing ( { tracePropagationTargets : [ 'myDomain.com' ] } ) ] ,
115
- enableTracing : true ,
118
+ expect ( integrationsToInit ) . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
119
+ expect ( browserTracing ) . toBeDefined ( ) ;
120
+ expect ( ( browserTracing as BrowserTracing ) . options . tracePropagationTargets ) . toEqual ( [ 'myDomain.com' ] ) ;
116
121
} ) ;
117
-
118
- const integrationsToInit = svelteInit . mock . calls [ 0 ] [ 0 ] . integrations ;
119
- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
120
-
121
- expect ( integrationsToInit ) . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
122
- expect ( browserTracing ) . toBeDefined ( ) ;
123
- expect ( ( browserTracing as BrowserTracing ) . options . tracePropagationTargets ) . toEqual ( [ 'myDomain.com' ] ) ;
124
122
} ) ;
125
123
} ) ;
126
124
} ) ;
0 commit comments