@@ -98,6 +98,7 @@ describe('instrumentRoot', () => {
9898 'import * as Sentry from "@sentry/react-router";' ,
9999 ) ;
100100 expect ( modifiedContent ) . toContain ( 'Sentry.captureException(error);' ) ;
101+ expect ( modifiedContent ) . toContain ( 'error instanceof Error' ) ;
101102 } ) ;
102103
103104 it ( 'should add Sentry.captureException to existing variable declaration ErrorBoundary' , async ( ) => {
@@ -117,6 +118,7 @@ describe('instrumentRoot', () => {
117118 ) ;
118119 // Now properly handles variable declaration ErrorBoundary
119120 expect ( modifiedContent ) . toContain ( 'Sentry.captureException(error);' ) ;
121+ expect ( modifiedContent ) . toContain ( 'error instanceof Error' ) ;
120122 } ) ;
121123
122124 it ( 'should not modify file when ErrorBoundary already has Sentry.captureException' , async ( ) => {
@@ -215,6 +217,7 @@ describe('instrumentRoot', () => {
215217 'import * as Sentry from "@sentry/react-router";' ,
216218 ) ;
217219 expect ( modifiedContent ) . toContain ( 'Sentry.captureException(error);' ) ;
220+ expect ( modifiedContent ) . toContain ( 'error instanceof Error' ) ;
218221 } ) ;
219222
220223 it ( 'should handle function declaration with separate export' , async ( ) => {
@@ -236,6 +239,7 @@ describe('instrumentRoot', () => {
236239 'import * as Sentry from "@sentry/react-router";' ,
237240 ) ;
238241 expect ( modifiedContent ) . toContain ( 'Sentry.captureException(error);' ) ;
242+ expect ( modifiedContent ) . toContain ( 'error instanceof Error' ) ;
239243
240244 // Should preserve function declaration syntax
241245 expect ( modifiedContent ) . toMatch ( / f u n c t i o n E r r o r B o u n d a r y \( / ) ;
0 commit comments