@@ -95,10 +95,7 @@ describe('TLS callback exception handling', () => {
9595reject ( e ) ;
9696}
9797} ) ) ;
98-
99- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
100- reject ( new Error ( 'secureConnection should not fire' ) ) ;
101- } ) ) ;
98+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
10299
103100await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
104101
@@ -113,7 +110,7 @@ describe('TLS callback exception handling', () => {
113110} ) ,
114111} ) ;
115112
116- client . on ( 'error' , ( ) => { } ) ;
113+ client . on ( 'error' , common . mustCall ( ) ) ;
117114
118115await promise ;
119116} ) ;
@@ -307,9 +304,7 @@ describe('TLS callback exception handling', () => {
307304}
308305} ) ) ;
309306
310- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
311- reject ( new Error ( 'secureConnection should not fire' ) ) ;
312- } ) ) ;
307+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection should not fire' ) ) ;
313308
314309await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
315310
@@ -324,7 +319,7 @@ describe('TLS callback exception handling', () => {
324319} ) ,
325320} ) ;
326321
327- client . on ( 'error' , ( ) => { } ) ;
322+ client . on ( 'error' , common . mustCall ( ) ) ;
328323
329324await promise ;
330325} ) ;
@@ -354,10 +349,7 @@ describe('TLS callback exception handling', () => {
354349reject ( e ) ;
355350}
356351} ) ) ;
357-
358- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
359- reject ( new Error ( 'secureConnection should not fire' ) ) ;
360- } ) ) ;
352+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
361353
362354await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
363355
@@ -368,7 +360,7 @@ describe('TLS callback exception handling', () => {
368360ALPNProtocols : [ 'http/1.1' , 'h2' ] ,
369361} ) ;
370362
371- client . on ( 'error' , ( ) => { } ) ;
363+ client . on ( 'error' , common . mustCall ( ) ) ;
372364
373365await promise ;
374366} ) ;
@@ -397,10 +389,8 @@ describe('TLS callback exception handling', () => {
397389reject ( e ) ;
398390}
399391} ) ) ;
392+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
400393
401- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
402- reject ( new Error ( 'secureConnection should not fire' ) ) ;
403- } ) ) ;
404394await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
405395
406396const client = tls . connect ( {
@@ -410,7 +400,7 @@ describe('TLS callback exception handling', () => {
410400ALPNProtocols : [ 'http/1.1' ] ,
411401} ) ;
412402
413- client . on ( 'error' , ( ) => { } ) ;
403+ client . on ( 'error' , common . mustCall ( ) ) ;
414404
415405await promise ;
416406} ) ;
@@ -429,9 +419,7 @@ describe('TLS callback exception handling', () => {
429419
430420const { promise, resolve, reject } = createTestPromise ( ) ;
431421
432- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
433- reject ( new Error ( 'secureConnection should not fire' ) ) ;
434- } ) ) ;
422+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
435423
436424await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
437425
@@ -473,9 +461,7 @@ describe('TLS callback exception handling', () => {
473461
474462const { promise, resolve, reject } = createTestPromise ( ) ;
475463
476- server . on ( 'secureConnection' , common . mustNotCall ( ( ) => {
477- reject ( new Error ( 'secureConnection should not fire' ) ) ;
478- } ) ) ;
464+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
479465
480466await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
481467
@@ -526,10 +512,7 @@ describe('TLS callback exception handling', () => {
526512reject ( e ) ;
527513}
528514} ) ) ;
529-
530- server . on ( 'secureConnection' , ( ) => {
531- reject ( new Error ( 'secureConnection should not fire' ) ) ;
532- } ) ;
515+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
533516
534517await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
535518
@@ -540,7 +523,7 @@ describe('TLS callback exception handling', () => {
540523rejectUnauthorized : false ,
541524} ) ;
542525
543- client . on ( 'error' , ( ) => { } ) ;
526+ client . on ( 'error' , common . mustCall ( ) ) ;
544527
545528await promise ;
546529} ) ;
@@ -573,10 +556,7 @@ describe('TLS callback exception handling', () => {
573556reject ( e ) ;
574557}
575558} ) ) ;
576-
577- server . on ( 'secureConnection' , ( ) => {
578- reject ( new Error ( 'secureConnection should not fire' ) ) ;
579- } ) ;
559+ server . on ( 'secureConnection' , common . mustNotCall ( 'secureConnection listener' ) ) ;
580560
581561await new Promise ( ( res ) => server . listen ( 0 , res ) ) ;
582562
@@ -587,7 +567,7 @@ describe('TLS callback exception handling', () => {
587567rejectUnauthorized : false ,
588568} ) ;
589569
590- client . on ( 'error' , ( ) => { } ) ;
570+ client . on ( 'error' , common . mustCall ( ) ) ;
591571
592572await promise ;
593573} ) ;
0 commit comments