node/test/parallel/test-net-better-error-messages-port-hostname.js
Natanael Copa 1a1ff77feb test: fix test-net-* error code check for getaddrinfo(3)
Replace '...' as invalid hostname with '***', which will give a more
consisten error message on different systems. The hostname '...' returns
EAI_AGAIN on musl libc and EAI_NONAME on most other systems.

By changing the testcase we get same restult on all known platforms.

PR-URL: https://github.com/nodejs/node/pull/5099
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-06-15 14:27:05 +10:00

15 lines
348 B
JavaScript

'use strict';
var common = require('../common');
var net = require('net');
var assert = require('assert');
var c = net.createConnection(common.PORT, '***');
c.on('connect', common.fail);
c.on('error', common.mustCall(function(e) {
assert.equal(e.code, 'ENOTFOUND');
assert.equal(e.port, common.PORT);
assert.equal(e.hostname, '***');
}));