dns-utils.js 704 B

1234567891011
  1. const dns = require('dns')
  2. // Node >=17 has different DNS resolution (see
  3. // https://github.com/nodejs/node/issues/40702), it resolves domains
  4. // according to the OS settings instead of IPv4-address first. The Karma server
  5. // only listens on IPv4 address (127.0.0.1) by default, but the requests are
  6. // sent to `localhost` in several places and `localhost` is resolved into IPv6
  7. // address (`::`). So the run/stop/proxy request is unable to reach the Karma
  8. // server and produces an error. To mitigate this issue karma force the
  9. // IPv4-address first approach in Node >=17 as well.
  10. module.exports.lookup = (hostname, options, callback) => dns.lookup(hostname, { ...options, verbatim: false }, callback)