diff --git a/test/parallel/test-net-socket-timeout.js b/test/parallel/test-net-socket-timeout.js index 2826b1dd76f146..a30ab8ce293764 100644 --- a/test/parallel/test-net-socket-timeout.js +++ b/test/parallel/test-net-socket-timeout.js @@ -34,15 +34,15 @@ const validDelays = [0, 0.001, 1, 1e6]; for (let i = 0; i < nonNumericDelays.length; i++) { - assert.throws(function() { + assert.throws(() => { s.setTimeout(nonNumericDelays[i], () => {}); - }, TypeError, nonNumericDelays[i]); + }, { code: 'ERR_INVALID_ARG_TYPE' }, nonNumericDelays[i]); } for (let i = 0; i < badRangeDelays.length; i++) { - assert.throws(function() { + assert.throws(() => { s.setTimeout(badRangeDelays[i], () => {}); - }, RangeError, badRangeDelays[i]); + }, { code: 'ERR_OUT_OF_RANGE' }, badRangeDelays[i]); } for (let i = 0; i < validDelays.length; i++) { @@ -50,9 +50,9 @@ for (let i = 0; i < validDelays.length; i++) { } const server = net.Server(); -server.listen(0, common.mustCall(function() { - const socket = net.createConnection(this.address().port); - socket.setTimeout(1, common.mustCall(function() { +server.listen(0, common.mustCall(() => { + const socket = net.createConnection(server.address().port); + socket.setTimeout(1, common.mustCall(() => { socket.destroy(); server.close(); }));