From d4ee91a7116cecad61f15e269505de88ee15574a Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Tue, 14 Jun 2022 14:42:22 +0100 Subject: [PATCH 1/2] chore(deps): Upgrade @relaycorp/ws-mock to v5.2.1 --- packages/daemon/package-lock.json | 34 ++++++++++---------- packages/daemon/package.json | 2 +- packages/daemon/src/server/websocket.spec.ts | 5 +-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/packages/daemon/package-lock.json b/packages/daemon/package-lock.json index ce27ced8a..0da6992e7 100644 --- a/packages/daemon/package-lock.json +++ b/packages/daemon/package-lock.json @@ -45,7 +45,7 @@ "devDependencies": { "@relaycorp/relaynet-testing": "^2.2.4", "@relaycorp/shared-config": "^1.6.1", - "@relaycorp/ws-mock": "^2.4.1", + "@relaycorp/ws-mock": "^5.2.1", "@types/default-gateway": "^3.0.1", "@types/is-valid-domain": "0.0.1", "@types/jest": "^27.0.3", @@ -1444,9 +1444,9 @@ } }, "node_modules/@relaycorp/ws-mock": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@relaycorp/ws-mock/-/ws-mock-2.4.1.tgz", - "integrity": "sha512-J0zctRQAv40MzswlJZTVVuzdF75x/Lq0SFTfIsjj815uowtvdHjMGtnTk//DLT+eg6oxOMX8IIGnS5jHVA4ZLQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@relaycorp/ws-mock/-/ws-mock-5.2.1.tgz", + "integrity": "sha512-i9+pzGicqzeZBWuEE4CNFfTWB56TgCDOmKy+qHvgcUrqYX5GOML2QAwxzmr1A5Dlevr1R+Smfk5Lui+uEhIaHg==", "dev": true, "dependencies": { "buffer-to-arraybuffer": "0.0.6", @@ -6665,6 +6665,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process-warning": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", + "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -6684,11 +6689,6 @@ "node": ">=10" } }, - "node_modules/process-warning": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" - }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -9421,9 +9421,9 @@ } }, "@relaycorp/ws-mock": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@relaycorp/ws-mock/-/ws-mock-2.4.1.tgz", - "integrity": "sha512-J0zctRQAv40MzswlJZTVVuzdF75x/Lq0SFTfIsjj815uowtvdHjMGtnTk//DLT+eg6oxOMX8IIGnS5jHVA4ZLQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@relaycorp/ws-mock/-/ws-mock-5.2.1.tgz", + "integrity": "sha512-i9+pzGicqzeZBWuEE4CNFfTWB56TgCDOmKy+qHvgcUrqYX5GOML2QAwxzmr1A5Dlevr1R+Smfk5Lui+uEhIaHg==", "dev": true, "requires": { "buffer-to-arraybuffer": "0.0.6", @@ -13436,6 +13436,11 @@ } } }, + "process-warning": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", + "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" + }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -13452,11 +13457,6 @@ "retry": "^0.12.0" } }, - "process-warning": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" - }, "prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", diff --git a/packages/daemon/package.json b/packages/daemon/package.json index 1eb819964..f0d84aef1 100644 --- a/packages/daemon/package.json +++ b/packages/daemon/package.json @@ -49,7 +49,7 @@ "devDependencies": { "@relaycorp/relaynet-testing": "^2.2.4", "@relaycorp/shared-config": "^1.6.1", - "@relaycorp/ws-mock": "^2.4.1", + "@relaycorp/ws-mock": "^5.2.1", "@types/default-gateway": "^3.0.1", "@types/is-valid-domain": "0.0.1", "@types/jest": "^27.0.3", diff --git a/packages/daemon/src/server/websocket.spec.ts b/packages/daemon/src/server/websocket.spec.ts index db82a0322..c799a4257 100644 --- a/packages/daemon/src/server/websocket.spec.ts +++ b/packages/daemon/src/server/websocket.spec.ts @@ -101,7 +101,6 @@ describe('WebSocket server configuration', () => { await mockClient.send(serverResponseFrame); const response = await mockClient.receive(); expect(response).toEqual(serverResponseFrame); - await mockClient.waitForPeerClosure(); }); expect(handlerSpied).toBeCalledWith(expect.any(Duplex), expect.any(EventEmitter), headers); @@ -134,7 +133,7 @@ describe('WebSocket server configuration', () => { await mockClient.connect(); const closureReason = 'I have to run'; - mockClient.close(WebSocketCode.NORMAL, closureReason); + mockClient.close(WebSocketCode.NORMAL, closureReason as any); expect(mockLogs).toContainEqual( partialPinoLog('debug', 'Closing connection', { @@ -213,7 +212,5 @@ describe('WebSocket server configuration', () => { socket.on('message', (message) => { connectionStream.write(message); }); - - setImmediate(() => socket.close()); } }); From faeb7bda47d42622991fa238620d1cdb4bf7909c Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Tue, 14 Jun 2022 14:44:51 +0100 Subject: [PATCH 2/2] revert mistake --- packages/daemon/src/server/websocket.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/daemon/src/server/websocket.spec.ts b/packages/daemon/src/server/websocket.spec.ts index c799a4257..712a210ba 100644 --- a/packages/daemon/src/server/websocket.spec.ts +++ b/packages/daemon/src/server/websocket.spec.ts @@ -133,7 +133,7 @@ describe('WebSocket server configuration', () => { await mockClient.connect(); const closureReason = 'I have to run'; - mockClient.close(WebSocketCode.NORMAL, closureReason as any); + mockClient.close(WebSocketCode.NORMAL, closureReason); expect(mockLogs).toContainEqual( partialPinoLog('debug', 'Closing connection', {