@@ -3609,9 +3609,7 @@ describe.each([
36093609 } ) ;
36103610 } ) ;
36113611
3612- ( name === "koa" || name === "hapi" || name === "hono"
3613- ? describe . skip
3614- : describe ) (
3612+ ( name === "koa" || name === "hono" ? describe . skip : describe ) (
36153613 "should call the next middleware for finished or errored requests when forwardError is enabled" ,
36163614 ( ) => {
36173615 let compiler ;
@@ -3643,11 +3641,15 @@ describe.each([
36433641 } ,
36443642 {
36453643 setupMiddlewares : ( middlewares ) => {
3646- middlewares . push ( ( _error , _req , res , _next ) => {
3647- nextWasCalled = true ;
3648- res . statusCode = 500 ;
3649- res . end ( "error" ) ;
3650- } ) ;
3644+ if ( name === "hapi" ) {
3645+ // There's no such thing as "the next route handler" in hapi. One request is matched to one or no route handlers.
3646+ } else {
3647+ middlewares . push ( ( _error , _req , res , _next ) => {
3648+ nextWasCalled = true ;
3649+ res . statusCode = 500 ;
3650+ res . end ( "error" ) ;
3651+ } ) ;
3652+ }
36513653
36523654 return middlewares ;
36533655 } ,
@@ -3714,8 +3716,12 @@ describe.each([
37143716 ) ;
37153717
37163718 expect ( response . statusCode ) . toBe ( 500 ) ;
3717- expect ( response . text ) . toBe ( "error" ) ;
3718- expect ( nextWasCalled ) . toBe ( true ) ;
3719+ if ( name !== "hapi" ) {
3720+ expect ( response . text ) . toBe ( "error" ) ;
3721+ expect ( nextWasCalled ) . toBe ( true ) ;
3722+ } else {
3723+ expect ( nextWasCalled ) . toBe ( false ) ;
3724+ }
37193725 } ) ;
37203726
37213727 it ( 'should return the "500" code for the "GET" request to the bundle file with etag and wrong "if-match" header' , async ( ) => {
@@ -3730,8 +3736,12 @@ describe.each([
37303736 . set ( "if-match" , "test" ) ;
37313737
37323738 expect ( response2 . statusCode ) . toBe ( 500 ) ;
3733- expect ( response2 . text ) . toBe ( "error" ) ;
3734- expect ( nextWasCalled ) . toBe ( true ) ;
3739+ if ( name !== "hapi" ) {
3740+ expect ( response2 . text ) . toBe ( "error" ) ;
3741+ expect ( nextWasCalled ) . toBe ( true ) ;
3742+ } else {
3743+ expect ( nextWasCalled ) . toBe ( false ) ;
3744+ }
37353745 } ) ;
37363746
37373747 it ( 'should return the "500" code for the "GET" request with the invalid range header' , async ( ) => {
@@ -3740,16 +3750,24 @@ describe.each([
37403750 . set ( "Range" , "bytes=9999999-" ) ;
37413751
37423752 expect ( response . statusCode ) . toBe ( 500 ) ;
3743- expect ( response . text ) . toBe ( "error" ) ;
3744- expect ( nextWasCalled ) . toBe ( true ) ;
3753+ if ( name !== "hapi" ) {
3754+ expect ( response . text ) . toBe ( "error" ) ;
3755+ expect ( nextWasCalled ) . toBe ( true ) ;
3756+ } else {
3757+ expect ( nextWasCalled ) . toBe ( false ) ;
3758+ }
37453759 } ) ;
37463760
37473761 it ( 'should return the "500" code for the "GET" request to the "image.svg" file when it throws a reading error' , async ( ) => {
37483762 const response = await req . get ( "/image.svg" ) ;
37493763
37503764 expect ( response . statusCode ) . toBe ( 500 ) ;
3751- expect ( response . text ) . toBe ( "error" ) ;
3752- expect ( nextWasCalled ) . toBe ( true ) ;
3765+ if ( name !== "hapi" ) {
3766+ expect ( response . text ) . toBe ( "error" ) ;
3767+ expect ( nextWasCalled ) . toBe ( true ) ;
3768+ } else {
3769+ expect ( nextWasCalled ) . toBe ( false ) ;
3770+ }
37533771 } ) ;
37543772
37553773 it ( 'should return the "200" code for the "HEAD" request to the bundle file' , async ( ) => {
0 commit comments