From 628fc498d503d2894dcca254c4e706ce5eb3bce8 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Tue, 4 Jul 2017 10:04:54 -0400 Subject: [PATCH] test: ignore connection errors for hostname check PR-URL: https://github.com/nodejs/node/pull/14073 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-http-hostname-typechecking.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http-hostname-typechecking.js b/test/parallel/test-http-hostname-typechecking.js index 74813e0582d853..e63af7d3f09ecc 100644 --- a/test/parallel/test-http-hostname-typechecking.js +++ b/test/parallel/test-http-hostname-typechecking.js @@ -18,10 +18,12 @@ vals.forEach((v) => { assert.throws(() => http.request({host: v}), errHost); }); -// These values are OK and should not throw synchronously +// These values are OK and should not throw synchronously. +// Only testing for 'hostname' validation so ignore connection errors. +const dontCare = () => {}; ['', undefined, null].forEach((v) => { assert.doesNotThrow(() => { - http.request({hostname: v}).on('error', () => {}).end(); - http.request({host: v}).on('error', () => {}).end(); + http.request({hostname: v}).on('error', dontCare).end(); + http.request({host: v}).on('error', dontCare).end(); }); });