diff --git a/test/parallel/test-net-listen-ipv6only.js b/test/sequential/test-net-listen-ipv6only.js similarity index 68% rename from test/parallel/test-net-listen-ipv6only.js rename to test/sequential/test-net-listen-ipv6only.js index a329011bcc8a23..c85f813bc08b3b 100644 --- a/test/parallel/test-net-listen-ipv6only.js +++ b/test/sequential/test-net-listen-ipv6only.js @@ -11,9 +11,13 @@ const net = require('net'); const host = '::'; const server = net.createServer(); +// Use a fixed port and run this test sequentially. The assertion below relies +// on nothing else listening on the IPv4 side of the chosen port; with an +// ephemeral port under parallel execution another test can occupy that IPv4 +// port, making the connection succeed instead of being refused. server.listen({ host, - port: 0, + port: common.PORT, ipv6Only: true, }, common.mustCall(() => { const { port } = server.address();