File tree Expand file tree Collapse file tree 5 files changed +74
-0
lines changed 
packages/nextjs/test/integration Expand file tree Collapse file tree 5 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ import  {  NextApiRequest ,  NextApiResponse  }  from  'next' ; 
2+ 
3+ const  handler  =  async  ( _req : NextApiRequest ,  res : NextApiResponse ) : Promise < void >  =>  { 
4+   res . status ( 200 ) . json ( { } ) ; 
5+ } ; 
6+ 
7+ export  default  handler ; 
Original file line number Diff line number Diff line change 1+ import  {  NextApiRequest ,  NextApiResponse  }  from  'next' ; 
2+ 
3+ const  handler  =  async  ( _req : NextApiRequest ,  res : NextApiResponse ) : Promise < void >  =>  { 
4+   res . status ( 200 ) . json ( { } ) ; 
5+ } ; 
6+ 
7+ export  default  handler ; 
Original file line number Diff line number Diff line change 1+ import  {  withSentry  }  from  '@sentry/nextjs' ; 
2+ import  {  NextApiRequest ,  NextApiResponse  }  from  'next' ; 
3+ 
4+ const  handler  =  async  ( _req : NextApiRequest ,  res : NextApiResponse ) : Promise < void >  =>  { 
5+   res . status ( 200 ) . json ( { } ) ; 
6+ } ; 
7+ 
8+ export  default  withSentry ( handler ) ; 
Original file line number Diff line number Diff line change 1+ import  {  withSentry  }  from  '@sentry/nextjs' ; 
2+ import  {  NextApiRequest ,  NextApiResponse  }  from  'next' ; 
3+ 
4+ const  handler  =  async  ( _req : NextApiRequest ,  res : NextApiResponse ) : Promise < void >  =>  { 
5+   res . status ( 200 ) . json ( { } ) ; 
6+ } ; 
7+ 
8+ export  default  withSentry ( handler ) ; 
Original file line number Diff line number Diff line change 1+ const  assert  =  require ( 'assert' ) ; 
2+ 
3+ const  {  sleep }  =  require ( '../utils/common' ) ; 
4+ const  {  getAsync,  interceptEventRequest,  interceptTracingRequest }  =  require ( '../utils/server' ) ; 
5+ 
6+ module . exports  =  async  ( {  url : urlBase ,  argv } )  =>  { 
7+   const  urls  =  { 
8+     unwrappedNoParamURL : `/api/withSentryAPI/unwrapped/noParams` , 
9+     wrappedNoParamURL : `/api/withSentryAPI/wrapped/noParams` , 
10+     unwrappedDynamicURL : `/api/withSentryAPI/unwrapped/dog` , 
11+     wrappedDynamicURL : `/api/withSentryAPI/wrapped/dog` , 
12+   } ; 
13+ 
14+   const  interceptedRequests  =  { } ; 
15+ 
16+   Object . entries ( urls ) . forEach ( ( [ testName ,  url ] )  =>  { 
17+     interceptedRequests [ testName ]  =  interceptTracingRequest ( 
18+       { 
19+         contexts : { 
20+           trace : { 
21+             op : 'http.server' , 
22+             status : 'ok' , 
23+             tags : {  'http.status_code' : '200'  } , 
24+           } , 
25+         } , 
26+         transaction : `GET ${ url . replace ( 'dog' ,  '[animal]' ) }  , 
27+         type : 'transaction' , 
28+         request : { 
29+           url : `${ urlBase } ${ url }  , 
30+         } , 
31+       } , 
32+       argv , 
33+       testName , 
34+     ) ; 
35+   } ) ; 
36+ 
37+   Object . values ( urls ) . forEach ( async  url  =>  await  getAsync ( `${ urlBase } ${ url }  ) ) ; 
38+ 
39+   await  sleep ( 500 ) ; 
40+ 
41+   Object . entries ( interceptedRequests ) . forEach ( ( [ testName ,  request ] )  => 
42+     assert . ok ( request . isDone ( ) ,  `Did not intercept transaction request for ${ testName }  ) , 
43+   ) ; 
44+ } ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments