@@ -416,94 +416,4 @@ describe('Vercel AI integration', () => {
416416 await createRunner ( ) . expect ( { transaction : EXPECTED_TRANSACTION_DEFAULT_PII_TRUE } ) . start ( ) . completed ( ) ;
417417 } ) ;
418418 } ) ;
419-
420- createEsmAndCjsTests ( __dirname , 'scenario-error.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
421- test ( 'Vercel AI errors should inherit parent trace context from manually created outer span' , async ( ) => {
422- let capturedTransaction : any ;
423- let capturedEvent : any ;
424-
425- const runner = createRunner ( )
426- . expect ( {
427- transaction : ( transaction : any ) => {
428- capturedTransaction = transaction ;
429- expect ( transaction . transaction ) . toBe ( 'outer span' ) ;
430- } ,
431- } )
432- . expect ( {
433- event : ( event : any ) => {
434- capturedEvent = event ;
435-
436- expect ( event ) . toMatchObject ( {
437- exception : {
438- values : expect . arrayContaining ( [
439- expect . objectContaining ( {
440- type : 'AI_ToolExecutionError' ,
441- value : 'Error executing tool calculateTool: Not implemented' ,
442- } ) ,
443- ] ) ,
444- } ,
445- } ) ;
446- } ,
447- } )
448- . start ( ) ;
449-
450- await runner . completed ( ) ;
451-
452- const transactionTraceId = capturedTransaction ?. contexts ?. trace ?. trace_id ;
453- const errorTraceId = capturedEvent ?. contexts ?. trace ?. trace_id ;
454-
455- expect ( transactionTraceId ) . toBeDefined ( ) ;
456- expect ( errorTraceId ) . toBeDefined ( ) ;
457- expect ( transactionTraceId ) . toMatch ( / ^ [ a - f 0 - 9 ] { 32 } $ / ) ;
458- expect ( errorTraceId ) . toMatch ( / ^ [ a - f 0 - 9 ] { 32 } $ / ) ;
459-
460- expect ( errorTraceId ) . toBe ( transactionTraceId ) ;
461- } ) ;
462- } ) ;
463-
464- createEsmAndCjsTests ( __dirname , 'scenario-express-error.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
465- test ( 'Vercel AI errors should inherit parent trace context from server HTTP request' , async ( ) => {
466- let capturedTransaction : any ;
467- let capturedEvent : any ;
468-
469- const runner = createRunner ( )
470- . withMockSentryServer ( )
471- . expect ( {
472- transaction : ( transaction : any ) => {
473- capturedTransaction = transaction ;
474- // Express creates a transaction like "GET /api/chat"
475- expect ( transaction . transaction ) . toBe ( 'GET /api/chat' ) ;
476- } ,
477- } )
478- . expect ( {
479- event : ( event : any ) => {
480- capturedEvent = event ;
481-
482- expect ( event ) . toMatchObject ( {
483- exception : {
484- values : expect . arrayContaining ( [
485- expect . objectContaining ( {
486- type : 'AI_ToolExecutionError' ,
487- value : 'Error executing tool calculateTool: Calculation service unavailable' ,
488- } ) ,
489- ] ) ,
490- } ,
491- } ) ;
492- } ,
493- } )
494- . start ( ) ;
495-
496- await runner . completed ( ) ;
497-
498- const transactionTraceId = capturedTransaction ?. contexts ?. trace ?. trace_id ;
499- const errorTraceId = capturedEvent ?. contexts ?. trace ?. trace_id ;
500-
501- expect ( transactionTraceId ) . toBeDefined ( ) ;
502- expect ( errorTraceId ) . toBeDefined ( ) ;
503- expect ( transactionTraceId ) . toMatch ( / ^ [ a - f 0 - 9 ] { 32 } $ / ) ;
504- expect ( errorTraceId ) . toMatch ( / ^ [ a - f 0 - 9 ] { 32 } $ / ) ;
505-
506- expect ( errorTraceId ) . toBe ( transactionTraceId ) ;
507- } ) ;
508- } ) ;
509419} ) ;
0 commit comments