@@ -23,28 +23,24 @@ const serverOptions = {
2323function test ( fn ) {
2424 if ( ! tests . length )
2525 process . nextTick ( run ) ;
26- tests . push ( fn ) ;
26+ tests . push ( common . mustCall ( fn ) ) ;
2727}
2828
2929function run ( ) {
3030 const fn = tests . shift ( ) ;
3131 if ( fn ) {
32- console . log ( '# %s' , fn . name ) ;
3332 fn ( run ) ;
34- } else {
35- console . log ( 'ok' ) ;
3633 }
3734}
3835
3936test ( function serverTimeout ( cb ) {
4037 const server = https . createServer (
4138 serverOptions ,
42- common . mustCall ( function ( req , res ) {
43- // just do nothing, we should get a
44- // timeout event.
39+ common . mustCall ( ( req , res ) => {
40+ // just do nothing, we should get a timeout event.
4541 } ) ) ;
46- server . listen ( common . mustCall ( function ( ) {
47- const s = server . setTimeout ( 50 , common . mustCall ( function ( socket ) {
42+ server . listen ( common . mustCall ( ( ) => {
43+ const s = server . setTimeout ( 50 , common . mustCall ( ( socket ) => {
4844 socket . destroy ( ) ;
4945 server . close ( ) ;
5046 cb ( ) ;
@@ -60,19 +56,16 @@ test(function serverTimeout(cb) {
6056test ( function serverRequestTimeout ( cb ) {
6157 const server = https . createServer (
6258 serverOptions ,
63- common . mustCall ( function ( req , res ) {
64- // just do nothing, we should get a
65- // timeout event.
66- const s = req . setTimeout (
67- 50 ,
68- common . mustCall ( function ( socket ) {
69- socket . destroy ( ) ;
70- server . close ( ) ;
71- cb ( ) ;
72- } ) ) ;
59+ common . mustCall ( ( req , res ) => {
60+ // just do nothing, we should get a timeout event.
61+ const s = req . setTimeout ( 50 , common . mustCall ( ( socket ) => {
62+ socket . destroy ( ) ;
63+ server . close ( ) ;
64+ cb ( ) ;
65+ } ) ) ;
7366 assert . ok ( s instanceof http . IncomingMessage ) ;
7467 } ) ) ;
75- server . listen ( common . mustCall ( function ( ) {
68+ server . listen ( common . mustCall ( ( ) => {
7669 const req = https . request ( {
7770 port : server . address ( ) . port ,
7871 method : 'POST' ,
@@ -87,16 +80,16 @@ test(function serverRequestTimeout(cb) {
8780test ( function serverResponseTimeout ( cb ) {
8881 const server = https . createServer (
8982 serverOptions ,
90- common . mustCall ( function ( req , res ) {
83+ common . mustCall ( ( req , res ) => {
9184 // just do nothing, we should get a timeout event.
92- const s = res . setTimeout ( 50 , common . mustCall ( function ( socket ) {
85+ const s = res . setTimeout ( 50 , common . mustCall ( ( socket ) => {
9386 socket . destroy ( ) ;
9487 server . close ( ) ;
9588 cb ( ) ;
9689 } ) ) ;
9790 assert . ok ( s instanceof http . OutgoingMessage ) ;
9891 } ) ) ;
99- server . listen ( common . mustCall ( function ( ) {
92+ server . listen ( common . mustCall ( ( ) => {
10093 https . get ( {
10194 port : server . address ( ) . port ,
10295 rejectUnauthorized : false
@@ -107,18 +100,18 @@ test(function serverResponseTimeout(cb) {
107100test ( function serverRequestNotTimeoutAfterEnd ( cb ) {
108101 const server = https . createServer (
109102 serverOptions ,
110- common . mustCall ( function ( req , res ) {
103+ common . mustCall ( ( req , res ) => {
111104 // just do nothing, we should get a timeout event.
112105 const s = req . setTimeout ( 50 , common . mustNotCall ( ) ) ;
113106 assert . ok ( s instanceof http . IncomingMessage ) ;
114107 res . on ( 'timeout' , common . mustCall ( ) ) ;
115108 } ) ) ;
116- server . on ( 'timeout' , common . mustCall ( function ( socket ) {
109+ server . on ( 'timeout' , common . mustCall ( ( socket ) => {
117110 socket . destroy ( ) ;
118111 server . close ( ) ;
119112 cb ( ) ;
120113 } ) ) ;
121- server . listen ( common . mustCall ( function ( ) {
114+ server . listen ( common . mustCall ( ( ) => {
122115 https . get ( {
123116 port : server . address ( ) . port ,
124117 rejectUnauthorized : false
@@ -129,32 +122,32 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
129122test ( function serverResponseTimeoutWithPipeline ( cb ) {
130123 let caughtTimeout = '' ;
131124 let secReceived = false ;
132- process . on ( 'exit' , function ( ) {
125+ process . on ( 'exit' , ( ) => {
133126 assert . strictEqual ( caughtTimeout , '/2' ) ;
134127 } ) ;
135- const server = https . createServer ( serverOptions , function ( req , res ) {
128+ const server = https . createServer ( serverOptions , ( req , res ) => {
136129 if ( req . url === '/2' )
137130 secReceived = true ;
138- const s = res . setTimeout ( 50 , function ( ) {
131+ const s = res . setTimeout ( 50 , ( ) => {
139132 caughtTimeout += req . url ;
140133 } ) ;
141134 assert . ok ( s instanceof http . OutgoingMessage ) ;
142135 if ( req . url === '/1' ) res . end ( ) ;
143136 } ) ;
144- server . on ( 'timeout' , function ( socket ) {
137+ server . on ( 'timeout' , common . mustCall ( ( socket ) => {
145138 if ( secReceived ) {
146139 socket . destroy ( ) ;
147140 server . close ( ) ;
148141 cb ( ) ;
149142 }
150- } ) ;
151- server . listen ( common . mustCall ( function ( ) {
143+ } ) ) ;
144+ server . listen ( common . mustCall ( ( ) => {
152145 const options = {
153146 port : server . address ( ) . port ,
154147 allowHalfOpen : true ,
155148 rejectUnauthorized : false
156149 } ;
157- const c = tls . connect ( options , function ( ) {
150+ const c = tls . connect ( options , ( ) => {
158151 c . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
159152 c . write ( 'GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
160153 c . write ( 'GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
@@ -165,25 +158,25 @@ test(function serverResponseTimeoutWithPipeline(cb) {
165158test ( function idleTimeout ( cb ) {
166159 const server = https . createServer (
167160 serverOptions ,
168- common . mustCall ( function ( req , res ) {
161+ common . mustCall ( ( req , res ) => {
169162 req . on ( 'timeout' , common . mustNotCall ( ) ) ;
170163 res . on ( 'timeout' , common . mustNotCall ( ) ) ;
171164 res . end ( ) ;
172165 } ) ) ;
173- const s = server . setTimeout ( 50 , common . mustCall ( function ( socket ) {
166+ const s = server . setTimeout ( 50 , common . mustCall ( ( socket ) => {
174167 socket . destroy ( ) ;
175168 server . close ( ) ;
176169 cb ( ) ;
177170 } ) ) ;
178171 assert . ok ( s instanceof https . Server ) ;
179- server . listen ( common . mustCall ( function ( ) {
172+ server . listen ( common . mustCall ( ( ) => {
180173 const options = {
181174 port : server . address ( ) . port ,
182175 allowHalfOpen : true ,
183176 rejectUnauthorized : false
184177 } ;
185- tls . connect ( options , function ( ) {
186- this . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
178+ const c = tls . connect ( options , ( ) => {
179+ c . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
187180 // Keep-Alive
188181 } ) ;
189182 } ) ) ;
0 commit comments