Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DNS resolver workaround from the test framework #17547

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
downloadManifestFiles,
verifyManifestFiles,
} from "./downloadutils.mjs";
import dns from "dns";
import fs from "fs";
import os from "os";
import path from "path";
Expand All @@ -34,21 +33,6 @@ import yargs from "yargs";

const rimrafSync = rimraf.sync;

// Chrome uses host `127.0.0.1` in the browser's websocket endpoint URL while
// Firefox uses `localhost`, which before Node.js 17 also resolved to the IPv4
// address `127.0.0.1` by Node.js' DNS resolver. However, this behavior changed
// in Node.js 17 where the default is to prefer an IPv6 address if one is
// offered (which varies based on the OS and/or how the `localhost` hostname
// resolution is configured), so it can now also resolve to `::1`. This causes
// Firefox to not start anymore since it doesn't bind on the `::1` interface.
// To avoid this, we switch Node.js' DNS resolver back to preferring IPv4
// since we connect to a local browser anyway. Only do this for Node.js versions
// that actually have this API since it got introduced in Node.js 14.18.0 and
// it's not relevant for older versions anyway.
if (dns.setDefaultResultOrder !== undefined) {
dns.setDefaultResultOrder("ipv4first");
}

function parseOptions() {
const parsedArgs = yargs(process.argv)
.usage("Usage: $0")
Expand Down