@@ -3,6 +3,7 @@ import * as SentrySolid from '@sentry/solid';
3
3
4
4
import { vi } from 'vitest' ;
5
5
import { init as solidStartInit } from '../../src/client' ;
6
+ import { solidRouterBrowserTracingIntegration } from '../../src/client/solidrouter' ;
6
7
7
8
const browserInit = vi . spyOn ( SentrySolid , 'init' ) ;
8
9
@@ -34,3 +35,43 @@ describe('Initialize Solid Start SDK', () => {
34
35
expect ( browserInit ) . toHaveBeenLastCalledWith ( expect . objectContaining ( expectedMetadata ) ) ;
35
36
} ) ;
36
37
} ) ;
38
+
39
+ describe ( 'browserTracingIntegration' , ( ) => {
40
+ it ( 'adds the `browserTracingIntegration` when `__SENTRY_TRACING__` is not set' , ( ) => {
41
+ const client = solidStartInit ( {
42
+ dsn :
'https://[email protected] /1337' ,
43
+ } ) ;
44
+
45
+ const browserTracingIntegration = client ?. getOptions ( ) . integrations . find ( integration => integration . name === 'BrowserTracing' ) ;
46
+ expect ( browserTracingIntegration ) . toBeDefined ( ) ;
47
+ expect ( browserTracingIntegration ! . isDefaultInstance ) . toEqual ( true ) ;
48
+ } ) ;
49
+
50
+ it ( "doesn't add the `browserTracingIntegration` if `__SENTRY_TRACING__` is false" , ( ) => {
51
+ // @ts -expect-error Test setup for build-time flag
52
+ globalThis . __SENTRY_TRACING__ = false ;
53
+
54
+ const client = solidStartInit ( {
55
+ dsn :
'https://[email protected] /1337' ,
56
+ } ) ;
57
+
58
+ const browserTracingIntegration = client ?. getOptions ( ) . integrations . find ( integration => integration . name === 'BrowserTracing' ) ;
59
+ expect ( browserTracingIntegration ) . toBeUndefined ( ) ;
60
+
61
+ // @ts -expect-error Test setup for build-time flag
62
+ delete globalThis . __SENTRY_TRACING__ ;
63
+ } ) ;
64
+
65
+ it ( "doesn't add the default `browserTracingIntegration` if `solidBrowserTracingIntegration` was already passed in" , ( ) => {
66
+ const client = solidStartInit ( {
67
+ integrations : [
68
+ solidRouterBrowserTracingIntegration ( ) ,
69
+ ] ,
70
+ dsn :
'https://[email protected] /1337' ,
71
+ } ) ;
72
+
73
+ const browserTracingIntegration = client ?. getOptions ( ) . integrations . find ( integration => integration . name === 'BrowserTracing' ) ;
74
+ expect ( browserTracingIntegration ) . toBeDefined ( ) ;
75
+ expect ( browserTracingIntegration ! . isDefaultInstance ) . toBeUndefined ( ) ;
76
+ } )
77
+ } ) ;
0 commit comments