@@ -43,28 +43,24 @@ const serverOptions = {
4343function test ( fn ) {
4444 if ( ! tests . length )
4545 process . nextTick ( run ) ;
46- tests . push ( fn ) ;
46+ tests . push ( common . mustCall ( fn ) ) ;
4747}
4848
4949function run ( ) {
5050 const fn = tests . shift ( ) ;
5151 if ( fn ) {
52- console . log ( '# %s' , fn . name ) ;
5352 fn ( run ) ;
54- } else {
55- console . log ( 'ok' ) ;
5653 }
5754}
5855
5956test ( function serverTimeout ( cb ) {
6057 const server = https . createServer (
6158 serverOptions ,
62- common . mustCall ( function ( req , res ) {
63- // just do nothing, we should get a
64- // timeout event.
59+ common . mustCall ( ( req , res ) => {
60+ // just do nothing, we should get a timeout event.
6561 } ) ) ;
66- server . listen ( common . mustCall ( function ( ) {
67- const s = server . setTimeout ( 50 , common . mustCall ( function ( socket ) {
62+ server . listen ( common . mustCall ( ( ) => {
63+ const s = server . setTimeout ( 50 , common . mustCall ( ( socket ) => {
6864 socket . destroy ( ) ;
6965 server . close ( ) ;
7066 cb ( ) ;
@@ -80,19 +76,16 @@ test(function serverTimeout(cb) {
8076test ( function serverRequestTimeout ( cb ) {
8177 const server = https . createServer (
8278 serverOptions ,
83- common . mustCall ( function ( req , res ) {
84- // just do nothing, we should get a
85- // timeout event.
86- const s = req . setTimeout (
87- 50 ,
88- common . mustCall ( function ( socket ) {
89- socket . destroy ( ) ;
90- server . close ( ) ;
91- cb ( ) ;
92- } ) ) ;
79+ common . mustCall ( ( req , res ) => {
80+ // just do nothing, we should get a timeout event.
81+ const s = req . setTimeout ( 50 , common . mustCall ( ( socket ) => {
82+ socket . destroy ( ) ;
83+ server . close ( ) ;
84+ cb ( ) ;
85+ } ) ) ;
9386 assert . ok ( s instanceof http . IncomingMessage ) ;
9487 } ) ) ;
95- server . listen ( common . mustCall ( function ( ) {
88+ server . listen ( common . mustCall ( ( ) => {
9689 const req = https . request ( {
9790 port : server . address ( ) . port ,
9891 method : 'POST' ,
@@ -107,16 +100,16 @@ test(function serverRequestTimeout(cb) {
107100test ( function serverResponseTimeout ( 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.
112- const s = res . setTimeout ( 50 , common . mustCall ( function ( socket ) {
105+ const s = res . setTimeout ( 50 , common . mustCall ( ( socket ) => {
113106 socket . destroy ( ) ;
114107 server . close ( ) ;
115108 cb ( ) ;
116109 } ) ) ;
117110 assert . ok ( s instanceof http . OutgoingMessage ) ;
118111 } ) ) ;
119- server . listen ( common . mustCall ( function ( ) {
112+ server . listen ( common . mustCall ( ( ) => {
120113 https . get ( {
121114 port : server . address ( ) . port ,
122115 rejectUnauthorized : false
@@ -127,18 +120,18 @@ test(function serverResponseTimeout(cb) {
127120test ( function serverRequestNotTimeoutAfterEnd ( cb ) {
128121 const server = https . createServer (
129122 serverOptions ,
130- common . mustCall ( function ( req , res ) {
123+ common . mustCall ( ( req , res ) => {
131124 // just do nothing, we should get a timeout event.
132125 const s = req . setTimeout ( 50 , common . mustNotCall ( ) ) ;
133126 assert . ok ( s instanceof http . IncomingMessage ) ;
134127 res . on ( 'timeout' , common . mustCall ( ) ) ;
135128 } ) ) ;
136- server . on ( 'timeout' , common . mustCall ( function ( socket ) {
129+ server . on ( 'timeout' , common . mustCall ( ( socket ) => {
137130 socket . destroy ( ) ;
138131 server . close ( ) ;
139132 cb ( ) ;
140133 } ) ) ;
141- server . listen ( common . mustCall ( function ( ) {
134+ server . listen ( common . mustCall ( ( ) => {
142135 https . get ( {
143136 port : server . address ( ) . port ,
144137 rejectUnauthorized : false
@@ -149,32 +142,32 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
149142test ( function serverResponseTimeoutWithPipeline ( cb ) {
150143 let caughtTimeout = '' ;
151144 let secReceived = false ;
152- process . on ( 'exit' , function ( ) {
145+ process . on ( 'exit' , ( ) => {
153146 assert . strictEqual ( caughtTimeout , '/2' ) ;
154147 } ) ;
155- const server = https . createServer ( serverOptions , function ( req , res ) {
148+ const server = https . createServer ( serverOptions , ( req , res ) => {
156149 if ( req . url === '/2' )
157150 secReceived = true ;
158- const s = res . setTimeout ( 50 , function ( ) {
151+ const s = res . setTimeout ( 50 , ( ) => {
159152 caughtTimeout += req . url ;
160153 } ) ;
161154 assert . ok ( s instanceof http . OutgoingMessage ) ;
162155 if ( req . url === '/1' ) res . end ( ) ;
163156 } ) ;
164- server . on ( 'timeout' , function ( socket ) {
157+ server . on ( 'timeout' , common . mustCall ( ( socket ) => {
165158 if ( secReceived ) {
166159 socket . destroy ( ) ;
167160 server . close ( ) ;
168161 cb ( ) ;
169162 }
170- } ) ;
171- server . listen ( common . mustCall ( function ( ) {
163+ } ) ) ;
164+ server . listen ( common . mustCall ( ( ) => {
172165 const options = {
173166 port : server . address ( ) . port ,
174167 allowHalfOpen : true ,
175168 rejectUnauthorized : false
176169 } ;
177- const c = tls . connect ( options , function ( ) {
170+ const c = tls . connect ( options , ( ) => {
178171 c . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
179172 c . write ( 'GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
180173 c . write ( 'GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
@@ -185,25 +178,25 @@ test(function serverResponseTimeoutWithPipeline(cb) {
185178test ( function idleTimeout ( cb ) {
186179 const server = https . createServer (
187180 serverOptions ,
188- common . mustCall ( function ( req , res ) {
181+ common . mustCall ( ( req , res ) => {
189182 req . on ( 'timeout' , common . mustNotCall ( ) ) ;
190183 res . on ( 'timeout' , common . mustNotCall ( ) ) ;
191184 res . end ( ) ;
192185 } ) ) ;
193- const s = server . setTimeout ( 50 , common . mustCall ( function ( socket ) {
186+ const s = server . setTimeout ( 50 , common . mustCall ( ( socket ) => {
194187 socket . destroy ( ) ;
195188 server . close ( ) ;
196189 cb ( ) ;
197190 } ) ) ;
198191 assert . ok ( s instanceof https . Server ) ;
199- server . listen ( common . mustCall ( function ( ) {
192+ server . listen ( common . mustCall ( ( ) => {
200193 const options = {
201194 port : server . address ( ) . port ,
202195 allowHalfOpen : true ,
203196 rejectUnauthorized : false
204197 } ;
205- tls . connect ( options , function ( ) {
206- this . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
198+ const c = tls . connect ( options , ( ) => {
199+ c . write ( 'GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n' ) ;
207200 // Keep-Alive
208201 } ) ;
209202 } ) ) ;
0 commit comments