diff --git a/test/cli/host-test.js b/test/cli/host-test.js index 3802dd2..05eadf2 100644 --- a/test/cli/host-test.js +++ b/test/cli/host-test.js @@ -69,28 +69,12 @@ function checkConnections (t, req, canConnect) { } } -test('localhost resolution', (t) => { - console.error('/etc/hosts\n' + fs.readFileSync('/etc/hosts', 'utf8')) - dns.lookup('localhost', (err, address, family) => { - t.error(err) - t.equal('127.0.0.1', address) - t.equal(4, family) - t.end() - }) -}) - testServer( 'Listening on all ports by default', [], null, ['127.0.0.1', 'localhost', otherAddress], [] ) -testServer( - 'Restricted to localhost', - ['--localhost'], 'localhost', - ['127.0.0.1', 'localhost'], [otherAddress] -) - testServer( 'Restricted to non-local host', ['--host', otherAddress], otherAddress, @@ -102,3 +86,14 @@ testServer( ['--host', '127.0.0.1'], '127.0.0.1', ['127.0.0.1'], ['::1'] ) + +dns.lookup('localhost', (err, address) => { + if (err) { + throw err + } + testServer( + 'Restricted to localhost', + ['--localhost'], 'localhost', + [address, 'localhost'], [otherAddress] + ) +})