mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

Fixed test-net-connect-local-error by moving the test from parallel to sequential. PR-URL: https://github.com/nodejs/node/pull/12964 Fixes: https://github.com/nodejs/node/issues/12950 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
30 lines
802 B
JavaScript
30 lines
802 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
const client = net.connect({
|
|
port: common.PORT + 1,
|
|
localPort: common.PORT,
|
|
localAddress: common.localhostIPv4
|
|
});
|
|
|
|
client.on('error', common.mustCall(function onError(err) {
|
|
assert.strictEqual(err.syscall, 'connect');
|
|
assert.strictEqual(err.code, 'ECONNREFUSED');
|
|
assert.strictEqual(
|
|
err.localPort,
|
|
common.PORT,
|
|
`${err.localPort} !== ${common.PORT} in ${err}`
|
|
);
|
|
assert.strictEqual(
|
|
err.localAddress,
|
|
common.localhostIPv4,
|
|
`${err.localAddress} !== ${common.localhostIPv4} in ${err}`
|
|
);
|
|
assert.strictEqual(
|
|
err.message,
|
|
`connect ECONNREFUSED ${err.address}:${err.port} ` +
|
|
`- Local (${err.localAddress}:${err.localPort})`
|
|
);
|
|
}));
|