@@ -2,6 +2,8 @@ import { test, expect } from '@playwright/test';
2
2
import { waitForTransaction , waitForError } from '../../../test-utils/event-proxy-server' ;
3
3
4
4
test ( 'Should create a transaction for middleware' , async ( { request } ) => {
5
+ test . skip ( process . env . TEST_ENV === 'development' , "Doesn't work in dev mode." ) ;
6
+
5
7
const middlewareTransactionPromise = waitForTransaction ( 'nextjs-13-app-dir' , async transactionEvent => {
6
8
return transactionEvent ?. transaction === 'middleware' && transactionEvent ?. contexts ?. trace ?. status === 'ok' ;
7
9
} ) ;
@@ -17,13 +19,17 @@ test('Should create a transaction for middleware', async ({ request }) => {
17
19
} ) ;
18
20
19
21
test ( '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
+
20
24
const middlewareTransactionPromise = waitForTransaction ( 'nextjs-13-app-dir' , async transactionEvent => {
21
25
return (
22
26
transactionEvent ?. transaction === 'middleware' && transactionEvent ?. contexts ?. trace ?. status === 'internal_error'
23
27
) ;
24
28
} ) ;
25
29
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
+ } ) ;
27
33
28
34
const middlewareTransaction = await middlewareTransactionPromise ;
29
35
@@ -33,11 +39,15 @@ test('Should create a transaction with error status for faulty middleware', asyn
33
39
} ) ;
34
40
35
41
test ( 'Records exceptions happening in middleware' , async ( { request } ) => {
42
+ test . skip ( process . env . TEST_ENV === 'development' , "Doesn't work in dev mode." ) ;
43
+
36
44
const errorEventPromise = waitForError ( 'nextjs-13-app-dir' , errorEvent => {
37
45
return errorEvent ?. exception ?. values ?. [ 0 ] ?. value === 'Middleware Error' ;
38
46
} ) ;
39
47
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
+ } ) ;
41
51
42
52
expect ( await errorEventPromise ) . toBeDefined ( ) ;
43
53
} ) ;
0 commit comments