Skip to content

Commit a117b3f

Browse files
committed
squash: skip test when ipv6 is not available
1 parent 4a1914c commit a117b3f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

test/parallel/test-net-happy-eyeballs.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ if (common.hasIPv6) {
178178
}
179179

180180
// Test that the option can be disabled
181-
{
181+
if (common.hasIPv6) {
182182
createDnsServer('::1', '127.0.0.1', common.mustCall(function({ dnsServer, lookup }) {
183183
const ipv4Server = createServer((socket) => {
184184
socket.on('data', common.mustCall(() => {
@@ -199,13 +199,8 @@ if (common.hasIPv6) {
199199

200200
connection.on('ready', common.mustNotCall());
201201
connection.on('error', common.mustCall((error) => {
202-
if (common.hasIPv6) {
203-
assert.strictEqual(error.code, 'ECONNREFUSED');
204-
assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`);
205-
} else {
206-
assert.strictEqual(error.code, 'EAFNOSUPPORT');
207-
assert.strictEqual(error.message, `connect EAFNOSUPPORT ::1:${port} - Local (undefined:undefined)`);
208-
}
202+
assert.strictEqual(error.code, 'ECONNREFUSED');
203+
assert.strictEqual(error.message, `connect ECONNREFUSED ::1:${port}`);
209204

210205
ipv4Server.close();
211206
dnsServer.close();

0 commit comments

Comments
 (0)