@@ -618,7 +618,7 @@ describe("proxy option", () => {
618618
619619 const BACKEND_MESSAGE_TYPE = "backend-message" ;
620620
621- beforeAll ( async ( ) => {
621+ before ( async ( ) => {
622622 backendUpgradeCount = 0 ;
623623
624624 backend = http . createServer ( ) ;
@@ -654,7 +654,7 @@ describe("proxy option", () => {
654654 await server . start ( ) ;
655655 } ) ;
656656
657- afterAll ( async ( ) => {
657+ after ( async ( ) => {
658658 for ( const client of backendWss . clients ) {
659659 client . terminate ( ) ;
660660 }
@@ -716,10 +716,8 @@ describe("proxy option", () => {
716716 let backend ;
717717 let stderrSpy ;
718718
719- beforeAll ( async ( ) => {
720- stderrSpy = jest
721- . spyOn ( process . stderr , "write" )
722- . mockImplementation ( ( ) => true ) ;
719+ before ( async ( ) => {
720+ stderrSpy = spyOn ( process . stderr , "write" ) . mockImplementation ( ( ) => true ) ;
723721
724722 backend = http . createServer ( ) ;
725723 backend . on ( "upgrade" , ( req , socket ) => {
@@ -751,7 +749,7 @@ describe("proxy option", () => {
751749 await server . start ( ) ;
752750 } ) ;
753751
754- afterAll ( async ( ) => {
752+ after ( async ( ) => {
755753 stderrSpy . mockRestore ( ) ;
756754 backend . closeAllConnections ( ) ;
757755 await server . stop ( ) ;
@@ -910,9 +908,9 @@ describe("proxy option", () => {
910908
911909 for ( const { type, hmrPath, nonHmrPath } of serverTypes ) {
912910 describe ( `with webSocketServerType: ${ type } ` , ( ) => {
913- beforeAll ( ( ) => setup ( { webSocketServer : type } ) ) ;
911+ before ( ( ) => setup ( { webSocketServer : type } ) ) ;
914912
915- afterAll ( teardown ) ;
913+ after ( teardown ) ;
916914
917915 it ( "serves the HMR upgrade locally and does not forward it to the proxy" , async ( ) => {
918916 const { opened, forwarded } = await probe ( hmrPath ) ;
@@ -933,9 +931,9 @@ describe("proxy option", () => {
933931 // `WebSocketServer#shouldHandle` does, so only the configured path (query
934932 // stripped) is the HMR socket; every other variant is forwarded.
935933 describe ( "with the `ws` server, path matching is exact" , ( ) => {
936- beforeAll ( ( ) => setup ( { webSocketServer : "ws" } ) ) ;
934+ before ( ( ) => setup ( { webSocketServer : "ws" } ) ) ;
937935
938- afterAll ( teardown ) ;
936+ after ( teardown ) ;
939937
940938 it . each ( [
941939 [ "exact path" , "/ws" ] ,
@@ -962,13 +960,13 @@ describe("proxy option", () => {
962960 // The HMR path is read from the configured `webSocketServer` options, not a
963961 // hardcoded `/ws`.
964962 describe ( "with a custom `ws` path" , ( ) => {
965- beforeAll ( ( ) =>
963+ before ( ( ) =>
966964 setup ( {
967965 webSocketServer : { type : "ws" , options : { path : "/custom-hmr" } } ,
968966 } ) ,
969967 ) ;
970968
971- afterAll ( teardown ) ;
969+ after ( teardown ) ;
972970
973971 it ( "treats the configured path (/custom-hmr) as the HMR upgrade path" , async ( ) => {
974972 const { forwarded } = await probe ( "/custom-hmr" ) ;
@@ -986,11 +984,11 @@ describe("proxy option", () => {
986984 // With no HMR server there is no socket to protect, so the filter never
987985 // engages and even `/ws` is forwarded to the user proxy.
988986 describe ( "without a webSocketServer" , ( ) => {
989- beforeAll ( ( ) =>
987+ before ( ( ) =>
990988 setup ( { hot : false , liveReload : false , webSocketServer : false } ) ,
991989 ) ;
992990
993- afterAll ( teardown ) ;
991+ after ( teardown ) ;
994992
995993 it ( "forwards /ws to the user proxy because there is no HMR socket to protect" , async ( ) => {
996994 const { forwarded } = await probe ( "/ws" ) ;
0 commit comments