From d91aec507269058e595cef2b3f70814e6b1b7476 Mon Sep 17 00:00:00 2001 From: pladaria Date: Fri, 31 Jan 2020 19:52:47 +0100 Subject: [PATCH 1/3] update deps --- package-lock.json | 26 +++++++++++++------------- package.json | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33957658..a46773ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3156,9 +3156,9 @@ "dev": true }, "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.2.tgz", + "integrity": "sha512-4PwqDL2laXtTWZghzzCtunQUTLbo31pcCJrd/B/9JP8XbhVzpS5ZXuKqlOzsd1rtcaLo4KqAn8nl8mkknS4MHw==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -3168,9 +3168,9 @@ }, "dependencies": { "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, "optional": true }, @@ -3181,13 +3181,13 @@ "dev": true }, "uglify-js": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", - "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", + "version": "3.7.6", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.6.tgz", + "integrity": "sha512-yYqjArOYSxvqeeiYH2VGjZOqq6SVmhxzaPjJC1W2F9e+bqvFL9QXQ2osQuKUFjM2hGjKG2YclQnRKWQSt/nOTQ==", "dev": true, "optional": true, "requires": { - "commander": "~2.20.0", + "commander": "~2.20.3", "source-map": "~0.6.1" } } @@ -7408,9 +7408,9 @@ } }, "typescript": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", - "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "dev": true }, "uglify-es": { diff --git a/package.json b/package.json index 981ba646..fee1d6c9 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "rollup-plugin-typescript2": "^0.23.0", "tslib": "^1.10.0", "tslint": "^5.19.0", - "typescript": "^3.5.3", + "typescript": "^3.7.5", "uglify-es": "^3.3.10", "ws": "^6.2.1" }, From 2563f4ce0212a87d96074bcb4712de7ebc7d5b86 Mon Sep 17 00:00:00 2001 From: pladaria Date: Fri, 31 Jan 2020 20:07:52 +0100 Subject: [PATCH 2/3] update unstable test --- test/test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index b1ac5f2f..5393257e 100644 --- a/test/test.js +++ b/test/test.js @@ -559,13 +559,16 @@ test.cb('connect, send, receive, reconnect', t => { }); }); -test.cb('immediately-failed connection should not timeout', t => { - const ws = new ReconnectingWebSocket('ws://thiswillfail.com', null, { +test.cb.only('immediately-failed connection should not timeout', t => { + const ws = new ReconnectingWebSocket('ws://x', null, { maxRetries: 2, connectionTimeout: 500, + minReconnectionDelay: 100, + maxReconnectionDelay: 100, }); ws.addEventListener('error', err => { + console.log(ws.retryCount); if (err.message === 'TIMEOUT') { t.fail(); } From 9160e21f0cc30734f987901911e34eb95c30d2db Mon Sep 17 00:00:00 2001 From: pladaria Date: Fri, 31 Jan 2020 20:35:36 +0100 Subject: [PATCH 3/3] stabilize tests --- test/test.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/test/test.js b/test/test.js index 5393257e..32439e23 100644 --- a/test/test.js +++ b/test/test.js @@ -559,21 +559,18 @@ test.cb('connect, send, receive, reconnect', t => { }); }); -test.cb.only('immediately-failed connection should not timeout', t => { - const ws = new ReconnectingWebSocket('ws://x', null, { +test.cb('immediately-failed connection should not timeout', t => { + const ws = new ReconnectingWebSocket('ws://255.255.255.255', null, { maxRetries: 2, connectionTimeout: 500, - minReconnectionDelay: 100, - maxReconnectionDelay: 100, }); ws.addEventListener('error', err => { - console.log(ws.retryCount); if (err.message === 'TIMEOUT') { t.fail(); } if (ws.retryCount === 2) { - setTimeout(() => t.end(), 1500); + setTimeout(() => t.end(), 500); } if (ws.retryCount > 2) { t.fail(); @@ -582,9 +579,9 @@ test.cb.only('immediately-failed connection should not timeout', t => { }); test.cb('immediately-failed connection with 0 maxRetries must not retry', t => { - const ws = new ReconnectingWebSocket('ws://thiswillfail.com', [], { + const ws = new ReconnectingWebSocket('ws://255.255.255.255', [], { maxRetries: 0, - connectionTimeout: 500, + connectionTimeout: 2000, minReconnectionDelay: 100, maxReconnectionDelay: 200, }); @@ -600,7 +597,7 @@ test.cb('immediately-failed connection with 0 maxRetries must not retry', t => { } setTimeout(() => { t.end(); - }, 500); + }, 2100); }); }); @@ -774,7 +771,7 @@ test.cb('closing from the other side should allow to keep closed', t => { }); test.cb('reconnection delay grow factor', t => { - const ws = new ReconnectingWebSocket('wss://bad.url', [], { + const ws = new ReconnectingWebSocket('wss://255.255.255.255', [], { minReconnectionDelay: 100, maxReconnectionDelay: 1000, reconnectionDelayGrowFactor: 2,