@@ -2,6 +2,8 @@ import { test, expect } from '@playwright/test';
22import { waitForTransaction , waitForError } from '../../../test-utils/event-proxy-server' ;
33
44test ( 'Should create a transaction for middleware' , async ( { request } ) => {
5+ test . skip ( process . env . TEST_ENV === 'development' , "Doesn't work in dev mode." ) ;
6+
57 const middlewareTransactionPromise = waitForTransaction ( 'nextjs-13-app-dir' , async transactionEvent => {
68 return transactionEvent ?. transaction === 'middleware' && transactionEvent ?. contexts ?. trace ?. status === 'ok' ;
79 } ) ;
@@ -17,13 +19,17 @@ test('Should create a transaction for middleware', async ({ request }) => {
1719} ) ;
1820
1921test ( 'Should create a transaction with error status for faulty middleware' , async ( { request } ) => {
22+ test . skip ( process . env . TEST_ENV === 'development' , "Doesn't work in dev mode." ) ;
23+
2024 const middlewareTransactionPromise = waitForTransaction ( 'nextjs-13-app-dir' , async transactionEvent => {
2125 return (
2226 transactionEvent ?. transaction === 'middleware' && transactionEvent ?. contexts ?. trace ?. status === 'internal_error'
2327 ) ;
2428 } ) ;
2529
26- request . get ( '/api/endpoint-behind-middleware' , { headers : { 'x-should-throw' : '1' } } ) ;
30+ request . get ( '/api/endpoint-behind-middleware' , { headers : { 'x-should-throw' : '1' } } ) . catch ( ( ) => {
31+ // Noop
32+ } ) ;
2733
2834 const middlewareTransaction = await middlewareTransactionPromise ;
2935
@@ -33,11 +39,15 @@ test('Should create a transaction with error status for faulty middleware', asyn
3339} ) ;
3440
3541test ( 'Records exceptions happening in middleware' , async ( { request } ) => {
42+ test . skip ( process . env . TEST_ENV === 'development' , "Doesn't work in dev mode." ) ;
43+
3644 const errorEventPromise = waitForError ( 'nextjs-13-app-dir' , errorEvent => {
3745 return errorEvent ?. exception ?. values ?. [ 0 ] ?. value === 'Middleware Error' ;
3846 } ) ;
3947
40- request . get ( '/api/endpoint-behind-middleware' , { headers : { 'x-should-throw' : '1' } } ) ;
48+ request . get ( '/api/endpoint-behind-middleware' , { headers : { 'x-should-throw' : '1' } } ) . catch ( ( ) => {
49+ // Noop
50+ } ) ;
4151
4252 expect ( await errorEventPromise ) . toBeDefined ( ) ;
4353} ) ;
0 commit comments