From d6934afcf22afed25b1b9fd06bd4b1df66659aae Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 31 Oct 2017 09:00:10 +0100 Subject: [PATCH] [test] Fix error validation on node 9 --- test/WebSocket.test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/WebSocket.test.js b/test/WebSocket.test.js index 3c6ec9eaf..db5304d88 100644 --- a/test/WebSocket.test.js +++ b/test/WebSocket.test.js @@ -84,10 +84,14 @@ describe('WebSocket', function () { }); it('accepts the localAddress option whether it was wrong interface', function () { - assert.throws( - () => new WebSocket(`ws://localhost:${port}`, { localAddress: '123.456.789.428' }), - /must be a valid IP: 123.456.789.428/ - ); + const localAddress = '123.456.789.428'; + + assert.throws(() => { + const ws = new WebSocket(`ws://localhost:${port}`, { localAddress }); + }, (err) => { + return err instanceof TypeError && (err.code === 'ERR_INVALID_IP_ADDRESS' || + err.message.includes(`must be a valid IP: ${localAddress}`)); + }); }); it('accepts the family option', function (done) {