@@ -1054,7 +1054,7 @@ describe('ReactNavigationInstrumentation', () => {
10541054
10551055 describe ( 'dynamic route params' , ( ) => {
10561056 it ( 'includes dynamic route params from [id] route' , async ( ) => {
1057- setupTestClient ( ) ;
1057+ setupTestClient ( { sendDefaultPii : true } ) ;
10581058 jest . runOnlyPendingTimers ( ) ; // Flush the init transaction
10591059
10601060 // Navigate to a static screen first so previous_route.name is set to a known value
@@ -1085,7 +1085,7 @@ describe('ReactNavigationInstrumentation', () => {
10851085 } ) ;
10861086
10871087 it ( 'includes dynamic route params from [...slug] catch-all route joined with /' , async ( ) => {
1088- setupTestClient ( ) ;
1088+ setupTestClient ( { sendDefaultPii : true } ) ;
10891089 jest . runOnlyPendingTimers ( ) ; // Flush the init transaction
10901090
10911091 mockNavigation . navigateToCatchAllRoute ( ) ;
@@ -1110,6 +1110,22 @@ describe('ReactNavigationInstrumentation', () => {
11101110 ) ;
11111111 } ) ;
11121112
1113+ it ( 'does not include dynamic route params when sendDefaultPii is disabled' , async ( ) => {
1114+ setupTestClient ( ) ;
1115+ jest . runOnlyPendingTimers ( ) ; // Flush the init transaction
1116+
1117+ mockNavigation . navigateToDynamicRoute ( ) ;
1118+ jest . runOnlyPendingTimers ( ) ;
1119+
1120+ await client . flush ( ) ;
1121+
1122+ const actualEvent = client . event ;
1123+ const traceData = actualEvent ?. contexts ?. trace ?. data as Record < string , unknown > ;
1124+
1125+ expect ( traceData [ SEMANTIC_ATTRIBUTE_ROUTE_NAME ] ) . toBe ( 'profile/[id]' ) ;
1126+ expect ( traceData [ 'route.params.id' ] ) . toBeUndefined ( ) ;
1127+ } ) ;
1128+
11131129 it ( 'does not include non-dynamic params from static routes' , async ( ) => {
11141130 setupTestClient ( ) ;
11151131 jest . runOnlyPendingTimers ( ) ; // Flush the init transaction
@@ -1131,6 +1147,7 @@ describe('ReactNavigationInstrumentation', () => {
11311147 setupOptions : {
11321148 beforeSpanStart ?: ( options : StartSpanOptions ) => StartSpanOptions ;
11331149 useDispatchedActionData ?: boolean ;
1150+ sendDefaultPii ?: boolean ;
11341151 } = { } ,
11351152 ) {
11361153 const rNavigation = reactNavigationIntegration ( {
@@ -1146,6 +1163,7 @@ describe('ReactNavigationInstrumentation', () => {
11461163 const options = getDefaultTestClientOptions ( {
11471164 enableNativeFramesTracking : false ,
11481165 enableStallTracking : false ,
1166+ sendDefaultPii : setupOptions . sendDefaultPii ,
11491167 tracesSampleRate : 1.0 ,
11501168 integrations : [ rNavigation , rnTracing ] ,
11511169 enableAppStartTracking : false ,
0 commit comments