diff --git a/test/parallel/test-net-reconnect-error.js b/test/sequential/test-net-reconnect-error.js similarity index 90% rename from test/parallel/test-net-reconnect-error.js rename to test/sequential/test-net-reconnect-error.js index d9a68e01d07..128feffc933 100644 --- a/test/parallel/test-net-reconnect-error.js +++ b/test/sequential/test-net-reconnect-error.js @@ -27,22 +27,19 @@ const N = 20; let client_error_count = 0; let disconnect_count = 0; -// Hopefully nothing is running on common.PORT const c = net.createConnection(common.PORT); c.on('connect', common.mustNotCall('client should not have connected')); -c.on('error', function(e) { - console.error(`CLIENT error: ${e.code}`); +c.on('error', common.mustCall((e) => { client_error_count++; assert.strictEqual('ECONNREFUSED', e.code); -}); +}, N + 1)); -c.on('close', function() { - console.log('CLIENT disconnect'); +c.on('close', common.mustCall(() => { if (disconnect_count++ < N) c.connect(common.PORT); // reconnect -}); +}, N + 1)); process.on('exit', function() { assert.strictEqual(N + 1, disconnect_count);