diff --git a/test/parallel/test-net-connect-local-error.js b/test/sequential/test-net-connect-local-error.js similarity index 53% rename from test/parallel/test-net-connect-local-error.js rename to test/sequential/test-net-connect-local-error.js index e656b6cb2ac0ab..9a8fd5bdee28f9 100644 --- a/test/parallel/test-net-connect-local-error.js +++ b/test/sequential/test-net-connect-local-error.js @@ -3,25 +3,28 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -const server = net.createServer(); -server.listen(0); -const port = server.address().port; const client = net.connect({ - port: port + 1, - localPort: port, + 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, - port, - `${err.localPort} !== ${port} in ${err}` + common.PORT, + `${err.localPort} !== ${common.PORT} in ${err}` ); assert.strictEqual( err.localAddress, common.localhostIPv4, `${err.localAddress} !== ${common.localhostIPv4} in ${err}` ); -})); -server.close(); + assert.strictEqual( + err.message, + `connect ECONNREFUSED ${err.address}:${err.port} ` + + `- Local (${err.localAddress}:${err.localPort})` + ); +})); \ No newline at end of file