diff --git a/test/parallel/test-http-hostname-typechecking.js b/test/parallel/test-http-hostname-typechecking.js index bcb175ee34171b..368766e087014b 100644 --- a/test/parallel/test-http-hostname-typechecking.js +++ b/test/parallel/test-http-hostname-typechecking.js @@ -36,7 +36,8 @@ vals.forEach((v) => { // These values are OK and should not throw synchronously. // Only testing for 'hostname' validation so ignore connection errors. const dontCare = () => {}; -['', undefined, null].forEach((v) => { +const values = ['', undefined, null]; +for (const v of values) { http.request({ hostname: v }).on('error', dontCare).end(); http.request({ host: v }).on('error', dontCare).end(); -}); +}