1'use strict'; 2 3const common = require('../common'); 4 5const assert = require('assert'); 6const dns = require('dns'); 7 8const localhost = [ '127.0.0.1' ]; 9 10{ 11 // Fix https://github.com/nodejs/node/issues/14734 12 13 { 14 const resolver = new dns.Resolver(); 15 resolver.resolve('localhost', common.mustCall()); 16 17 assert.throws(resolver.setServers.bind(resolver, localhost), { 18 code: 'ERR_DNS_SET_SERVERS_FAILED', 19 message: /^c-ares failed to set servers: "There are pending queries\." \[.+\]$/g 20 }); 21 } 22 23 { 24 dns.resolve('localhost', common.mustCall()); 25 26 // should not throw 27 dns.setServers(localhost); 28 } 29} 30