From 6be405bd7bf1d23dd1d6d1b795b83a226f638f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 5 Sep 2021 17:38:36 +0200 Subject: [PATCH] test: fix test-dgram-udp6-link-local-address on Windows PR-URL: https://github.com/nodejs/node/pull/40005 Reviewed-By: Rich Trott --- test/parallel/test-dgram-udp6-link-local-address.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-dgram-udp6-link-local-address.js b/test/parallel/test-dgram-udp6-link-local-address.js index bb7307de2430db..5c090acc6b9e11 100644 --- a/test/parallel/test-dgram-udp6-link-local-address.js +++ b/test/parallel/test-dgram-udp6-link-local-address.js @@ -7,6 +7,8 @@ const assert = require('assert'); const dgram = require('dgram'); const os = require('os'); +const { isWindows } = common; + function linklocal() { for (const [ifname, entries] of Object.entries(os.networkInterfaces())) { for (const { address, family, scopeid } of entries) { @@ -21,7 +23,7 @@ const iface = linklocal(); if (!iface) common.skip('cannot find any IPv6 interfaces with a link local address'); -const address = `${iface.address}%${iface.ifname}`; +const address = isWindows ? iface.address : `${iface.address}%${iface.ifname}`; const message = 'Hello, local world!'; // Create a client socket for sending to the link-local address. @@ -42,7 +44,7 @@ server.on('message', common.mustCall((buf, info) => { // including the link local scope identifier. assert.strictEqual( info.address, - common.isWindows ? `${iface.address}%${iface.scopeid}` : address + isWindows ? `${iface.address}%${iface.scopeid}` : address ); server.close(); client.close();