From 95c1766ceba00b8ac6d5545452f4eabd984d736a 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 --- 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..15e531c0b8bd52 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(); }); });