diff options
Diffstat (limited to 'test/parallel/test-regress-GH-5727.js')
-rw-r--r-- | test/parallel/test-regress-GH-5727.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js index 7cedd831b2..053719c6fa 100644 --- a/test/parallel/test-regress-GH-5727.js +++ b/test/parallel/test-regress-GH-5727.js @@ -4,7 +4,6 @@ const assert = require('assert'); const net = require('net'); const invalidPort = -1 >>> 0; -const errorMessage = /"port" argument must be >= 0 and < 65536/; net.Server().listen(0, function() { const address = this.address(); @@ -17,14 +16,23 @@ net.Server().listen(0, function() { // The first argument is a configuration object assert.throws(() => { net.Server().listen({ port: invalidPort }, common.mustNotCall()); -}, errorMessage); +}, common.expectsError({ + code: 'ERR_SOCKET_BAD_PORT', + type: RangeError +})); // The first argument is the port, no IP given. assert.throws(() => { net.Server().listen(invalidPort, common.mustNotCall()); -}, errorMessage); +}, common.expectsError({ + code: 'ERR_SOCKET_BAD_PORT', + type: RangeError +})); // The first argument is the port, the second an IP. assert.throws(() => { net.Server().listen(invalidPort, '0.0.0.0', common.mustNotCall()); -}, errorMessage); +}, common.expectsError({ + code: 'ERR_SOCKET_BAD_PORT', + type: RangeError +})); |