From a117b3f3b140c7dd79a5cdf9b5a1b96026d6317f Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Thu, 15 Dec 2022 03:49:14 +0800 Subject: [PATCH] squash: skip test when ipv6 is not available --- test/parallel/test-net-happy-eyeballs.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-net-happy-eyeballs.js b/test/parallel/test-net-happy-eyeballs.js index 5ecbbab08ab946..65725247bb9a39 100644 --- a/test/parallel/test-net-happy-eyeballs.js +++ b/test/parallel/test-net-happy-eyeballs.js @@ -178,7 +178,7 @@ if (common.hasIPv6) { } // Test that the option can be disabled -{ +if (common.hasIPv6) { createDnsServer('::1', '127.0.0.1', common.mustCall(function({ dnsServer, lookup }) { const ipv4Server = createServer((socket) => { socket.on('data', common.mustCall(() => { @@ -199,13 +199,8 @@ if (common.hasIPv6) { connection.on('ready', common.mustNotCall()); connection.on('error', common.mustCall((error) => { - if (common.hasIPv6) { - assert.strictEqual(error.code, 'ECONNREFUSED'); - assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`); - } else { - assert.strictEqual(error.code, 'EAFNOSUPPORT'); - assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`); - } + assert.strictEqual(error.code, 'ECONNREFUSED'); + assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`); ipv4Server.close(); dnsServer.close();