File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -453,8 +453,12 @@ tests.FWD_ERRORS_1 = function () {
453453 var toThrow = new Error ( "Forced exception" ) ;
454454 var recordedError = null ;
455455
456- var originalHandlers = client3 . listeners ( "error" ) ;
456+ var originalHandlers = {
457+ "error" : client3 . listeners ( "error" ) ,
458+ "message" : client3 . listeners ( "message" )
459+ } ;
457460 client3 . removeAllListeners ( "error" ) ;
461+ client3 . removeAllListeners ( "message" ) ;
458462 client3 . once ( "error" , function ( err ) {
459463 recordedError = err ;
460464 } ) ;
@@ -470,8 +474,15 @@ tests.FWD_ERRORS_1 = function () {
470474
471475 client . publish ( name , "Some message" ) ;
472476 setTimeout ( function ( ) {
473- client3 . listeners ( "error" ) . push ( originalHandlers ) ;
474477 assert . equal ( recordedError , toThrow , "Should have caught our forced exception" ) ;
478+ client3 . unsubscribe ( name ) ;
479+ client3 . removeAllListeners ( "message" ) ;
480+ originalHandlers . error . forEach ( function ( fn ) {
481+ client3 . on ( "error" , fn ) ;
482+ } ) ;
483+ originalHandlers . message . forEach ( function ( fn ) {
484+ client3 . on ( "message" , fn ) ;
485+ } ) ;
475486 next ( name ) ;
476487 } , 150 ) ;
477488} ;
You can’t perform that action at this time.
0 commit comments