From c8709bda407abb7081de2b5b56a4dc8fa3d244d1 Mon Sep 17 00:00:00 2001 From: dblythy Date: Sun, 6 Nov 2022 16:30:00 +1100 Subject: [PATCH 01/14] Update ci.yml --- .github/workflows/ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 106ca8990..aab6b0ef0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,18 @@ jobs: build: runs-on: ubuntu-18.04 timeout-minutes: 30 - env: + env: MONGODB_VERSION: 3.6.9 + strategy: + matrix: + include: + - name: Node 14 + NODE_VERSION: 14.19.1 + - name: Node 16 + NODE_VERSION: 16.14.2 + - name: Node 18 + NODE_VERSION: 18.8.0 + fail-fast: false steps: - name: Fix usage of insecure GitHub protocol run: sudo git config --system url."https://github".insteadOf "git://github" @@ -28,7 +38,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: 14 + node-version: ${{ matrix.node-version }} - name: Cache Node.js modules uses: actions/cache@v2 with: From a0e662ac939a82a00de86975b0ab9c2108f2da65 Mon Sep 17 00:00:00 2001 From: dblythy Date: Tue, 8 Nov 2022 12:58:40 +1100 Subject: [PATCH 02/14] add node 15 --- .github/workflows/ci.yml | 4 ++++ README.md | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aab6b0ef0..3adbdef29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,12 @@ jobs: strategy: matrix: include: + - name: Node 12 + NODE_VERSION: 12.22.11 - name: Node 14 NODE_VERSION: 14.19.1 + - name: Node 15 + NODE_VERSION: 15.14.0 - name: Node 16 NODE_VERSION: 16.14.2 - name: Node 18 diff --git a/README.md b/README.md index 06d7410f5..06edc55b3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-JS/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-JS) [![Coverage](http://codecov.io/github/parse-community/Parse-SDK-JS/coverage.svg?branch=alpha)](http://codecov.io/github/parse-community/Parse-SDK-JS?branch=alpha) -[![Node Version](https://img.shields.io/badge/nodejs-12,_14,_15-green.svg?logo=node.js&style=flat)](https://nodejs.org/) +[![Node Version](https://img.shields.io/badge/nodejs-12,_14,_15,_16,_18-green.svg?logo=node.js&style=flat)](https://nodejs.org/) [![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases) [![npm latest version](https://img.shields.io/npm/v/parse/latest.svg)](https://www.npmjs.com/package/parse) @@ -113,12 +113,12 @@ And don't forget, if you plan to deploy it remotely, you should run `npm install We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the [Contributing to Parse Javascript SDK guide][contributing]. - + [3rd-party-auth]: http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication [contributing]: https://github.com/parse-community/Parse-SDK-JS/blob/master/CONTRIBUTING.md [custom-auth-module]: https://docs.parseplatform.org/js/guide/#custom-authentication-module [link-with]: https://docs.parseplatform.org/js/guide/#linking-users [migration]: https://github.com/parse-community/Parse-SDK-JS/blob/master/2.0.0.md [open-collective-link]: https://opencollective.com/parse-server -[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse +[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse [license-link]: LICENSE From adee1559e17124fd4e103c9e7401a25da6890a23 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 02:37:50 +0100 Subject: [PATCH 03/14] fix incorrect node version key --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3adbdef29..df520b9c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ matrix.NODE_VERSION }} - name: Cache Node.js modules uses: actions/cache@v2 with: From e06b1f9ba52d43699f31c511513cb507e1571821 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 02:48:50 +0100 Subject: [PATCH 04/14] upgrade node versions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df520b9c3..35c247dcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,13 @@ jobs: - name: Node 12 NODE_VERSION: 12.22.11 - name: Node 14 - NODE_VERSION: 14.19.1 + NODE_VERSION: 14.21.1 - name: Node 15 NODE_VERSION: 15.14.0 - name: Node 16 - NODE_VERSION: 16.14.2 + NODE_VERSION: 16.18.1 - name: Node 18 - NODE_VERSION: 18.8.0 + NODE_VERSION: 18.12.1 fail-fast: false steps: - name: Fix usage of insecure GitHub protocol From da629de062724187a38b92ca108d1176d3d4fa70 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 02:50:36 +0100 Subject: [PATCH 05/14] fix node 18 build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35c247dcc..d54f0890b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: with: version: 1 build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 env: MONGODB_VERSION: 3.6.9 From ec88a1eba786dff0e8e940850d6cb577d3d489cd Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 14:33:24 +0100 Subject: [PATCH 06/14] remove node 12, 15 from CI --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d54f0890b..bfd7b189e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,12 +24,8 @@ jobs: strategy: matrix: include: - - name: Node 12 - NODE_VERSION: 12.22.11 - name: Node 14 NODE_VERSION: 14.21.1 - - name: Node 15 - NODE_VERSION: 15.14.0 - name: Node 16 NODE_VERSION: 16.18.1 - name: Node 18 From d84c5767a5c912ba8e9f3ff38cc65e2f085229e5 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 14:47:24 +0100 Subject: [PATCH 07/14] switch back to ubuntu 18.04 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfd7b189e..bf878727d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: with: version: 1 build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 timeout-minutes: 30 env: MONGODB_VERSION: 3.6.9 From d3aa856ca426a9e304b8cad1e0b4b89b98eec5f2 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:10:17 +0100 Subject: [PATCH 08/14] use latest --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf878727d..bfd7b189e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: with: version: 1 build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 env: MONGODB_VERSION: 3.6.9 From 43502a94e890101f78b7ed4cd41521bf93fefecf Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:12:06 +0100 Subject: [PATCH 09/14] remove mongodb env var --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfd7b189e..4ad41854f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,6 @@ jobs: build: runs-on: ubuntu-latest timeout-minutes: 30 - env: - MONGODB_VERSION: 3.6.9 strategy: matrix: include: From 041bd098fd1ffbd7f89f12dd201b94edab328634 Mon Sep 17 00:00:00 2001 From: dblythy Date: Fri, 11 Nov 2022 15:50:36 +1100 Subject: [PATCH 10/14] remove localhost --- integration/test/ParseDistTest.js | 2 +- integration/test/ParseLiveQueryTest.js | 2 +- integration/test/clear.js | 2 +- integration/test/helper.js | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration/test/ParseDistTest.js b/integration/test/ParseDistTest.js index 7beb32ab8..4304cc04c 100644 --- a/integration/test/ParseDistTest.js +++ b/integration/test/ParseDistTest.js @@ -4,7 +4,7 @@ for (const fileName of ['parse.js', 'parse.min.js']) { beforeAll(async () => { const browser = await puppeteer.launch(); page = await browser.newPage(); - await page.goto(`http://localhost:1337/${fileName}`); + await page.goto(`http://127.0.0.1:1337/${fileName}`); }); describe(`Parse Dist Test ${fileName}`, () => { it('can save an object', async () => { diff --git a/integration/test/ParseLiveQueryTest.js b/integration/test/ParseLiveQueryTest.js index d3089f691..795c06da9 100644 --- a/integration/test/ParseLiveQueryTest.js +++ b/integration/test/ParseLiveQueryTest.js @@ -53,7 +53,7 @@ describe('Parse LiveQuery', () => { it('can subscribe to query with null connect fields', async done => { const client = new Parse.LiveQueryClient({ applicationId: 'integration', - serverURL: 'ws://localhost:1337', + serverURL: 'ws://127.0.0.1:1337', javascriptKey: null, masterKey: null, sessionToken: null, diff --git a/integration/test/clear.js b/integration/test/clear.js index 2ae35ef2a..a468ecb3f 100644 --- a/integration/test/clear.js +++ b/integration/test/clear.js @@ -8,5 +8,5 @@ const Parse = require('../../node'); * @returns {Promise} A promise that is resolved when database is deleted. */ module.exports = function (fast = true) { - return Parse._ajax('GET', `http://localhost:1337/clear/${fast}`, ''); + return Parse._ajax('GET', `http://127.0.0.1:1337/clear/${fast}`, ''); }; diff --git a/integration/test/helper.js b/integration/test/helper.js index 10ceb92ee..7d8801c65 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -13,7 +13,7 @@ const path = require('path'); const port = 1337; const mountPath = '/parse'; -const serverURL = 'http://localhost:1337/parse'; +const serverURL = 'http://127.0.0.1:1337/parse'; let didChangeConfiguration = false; /* @@ -33,7 +33,7 @@ const twitterAuthData = { }; const defaultConfiguration = { - databaseURI: 'mongodb://localhost:27017/integration', + databaseURI: 'mongodb://127.0.0.1:27017/integration', appId: 'integration', masterKey: 'notsosecret', serverURL, @@ -130,7 +130,7 @@ const reconfigureServer = (changedConfiguration = {}) => { From 27e119d2402ba1789e6ec81565aa31de6e443771 Mon Sep 17 00:00:00 2001 From: dblythy Date: Fri, 11 Nov 2022 16:11:49 +1100 Subject: [PATCH 11/14] Update helper.js --- integration/test/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/test/helper.js b/integration/test/helper.js index 7d8801c65..edc769fcb 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -57,7 +57,7 @@ const defaultConfiguration = { }, }, verbose: false, - silent: true, + silent: false, push: { android: { senderId: 'yolo', From 34175f88adfd6e6ac7f89942093f1d62c941a2c9 Mon Sep 17 00:00:00 2001 From: dblythy Date: Tue, 15 Nov 2022 11:00:07 +1100 Subject: [PATCH 12/14] add dns --- integration/test/ParseDistTest.js | 2 +- integration/test/ParseLiveQueryTest.js | 2 +- integration/test/clear.js | 2 +- integration/test/helper.js | 12 +++++++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/integration/test/ParseDistTest.js b/integration/test/ParseDistTest.js index 4304cc04c..7beb32ab8 100644 --- a/integration/test/ParseDistTest.js +++ b/integration/test/ParseDistTest.js @@ -4,7 +4,7 @@ for (const fileName of ['parse.js', 'parse.min.js']) { beforeAll(async () => { const browser = await puppeteer.launch(); page = await browser.newPage(); - await page.goto(`http://127.0.0.1:1337/${fileName}`); + await page.goto(`http://localhost:1337/${fileName}`); }); describe(`Parse Dist Test ${fileName}`, () => { it('can save an object', async () => { diff --git a/integration/test/ParseLiveQueryTest.js b/integration/test/ParseLiveQueryTest.js index 795c06da9..d3089f691 100644 --- a/integration/test/ParseLiveQueryTest.js +++ b/integration/test/ParseLiveQueryTest.js @@ -53,7 +53,7 @@ describe('Parse LiveQuery', () => { it('can subscribe to query with null connect fields', async done => { const client = new Parse.LiveQueryClient({ applicationId: 'integration', - serverURL: 'ws://127.0.0.1:1337', + serverURL: 'ws://localhost:1337', javascriptKey: null, masterKey: null, sessionToken: null, diff --git a/integration/test/clear.js b/integration/test/clear.js index a468ecb3f..2ae35ef2a 100644 --- a/integration/test/clear.js +++ b/integration/test/clear.js @@ -8,5 +8,5 @@ const Parse = require('../../node'); * @returns {Promise} A promise that is resolved when database is deleted. */ module.exports = function (fast = true) { - return Parse._ajax('GET', `http://127.0.0.1:1337/clear/${fast}`, ''); + return Parse._ajax('GET', `http://localhost:1337/clear/${fast}`, ''); }; diff --git a/integration/test/helper.js b/integration/test/helper.js index edc769fcb..100ed2cd8 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -10,10 +10,16 @@ const { TestUtils } = require('parse-server'); const Parse = require('../../node'); const fs = require('fs'); const path = require('path'); +const dns = require('dns'); + +// Ensure localhost resolves to ipv4 address first on node v17+ +if (dns.setDefaultResultOrder) { + dns.setDefaultResultOrder('ipv4first'); +} const port = 1337; const mountPath = '/parse'; -const serverURL = 'http://127.0.0.1:1337/parse'; +const serverURL = 'http://localhost:1337/parse'; let didChangeConfiguration = false; /* @@ -33,7 +39,7 @@ const twitterAuthData = { }; const defaultConfiguration = { - databaseURI: 'mongodb://127.0.0.1:27017/integration', + databaseURI: 'mongodb://localhost:27017/integration', appId: 'integration', masterKey: 'notsosecret', serverURL, @@ -130,7 +136,7 @@ const reconfigureServer = (changedConfiguration = {}) => { From 75ba9c5b97a7b6535ec8a31cde91a9eba91fe477 Mon Sep 17 00:00:00 2001 From: dblythy Date: Tue, 15 Nov 2022 11:00:43 +1100 Subject: [PATCH 13/14] Update helper.js --- integration/test/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/test/helper.js b/integration/test/helper.js index 100ed2cd8..32292d8d9 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -63,7 +63,7 @@ const defaultConfiguration = { }, }, verbose: false, - silent: false, + silent: true, push: { android: { senderId: 'yolo', From 9198b4edcd53edf386a54dd4f5d7bf702e136592 Mon Sep 17 00:00:00 2001 From: dblythy Date: Wed, 16 Nov 2022 20:52:32 +1100 Subject: [PATCH 14/14] Update LiveQueryClient-test.js --- src/__tests__/LiveQueryClient-test.js | 28 ++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/__tests__/LiveQueryClient-test.js b/src/__tests__/LiveQueryClient-test.js index 4329bcd01..735659722 100644 --- a/src/__tests__/LiveQueryClient-test.js +++ b/src/__tests__/LiveQueryClient-test.js @@ -307,7 +307,7 @@ describe('LiveQueryClient', () => { expect(liveQueryClient.subscriptions.size).toBe(1); }); - it('can handle WebSocket error response message', () => { + it('can handle WebSocket error response message', async () => { const liveQueryClient = new LiveQueryClient({ applicationId: 'applicationId', serverURL: 'ws://test', @@ -329,13 +329,17 @@ describe('LiveQueryClient', () => { isChecked = true; expect(error).toEqual('error'); }); - - liveQueryClient._handleWebSocketMessage(event); + try { + liveQueryClient._handleWebSocketMessage(event); + await liveQueryClient.connectPromise; + } catch (error) { + expect(error.message).toEqual('error'); + } expect(isChecked).toBe(true); }); - it('can handle WebSocket error while subscribing', () => { + it('can handle WebSocket error while subscribing', async () => { const liveQueryClient = new LiveQueryClient({ applicationId: 'applicationId', serverURL: 'ws://test', @@ -363,7 +367,12 @@ describe('LiveQueryClient', () => { expect(error).toEqual('error thrown'); }); - liveQueryClient._handleWebSocketMessage(event); + try { + liveQueryClient._handleWebSocketMessage(event); + await Promise.all([subscription.connectPromise, subscription.subscribePromise, liveQueryClient.connectPromise, liveQueryClient.subscribePromise]); + } catch (e) { + expect(e.message).toEqual('error thrown'); + } jest.runOnlyPendingTimers(); expect(isChecked).toBe(true); @@ -740,7 +749,7 @@ describe('LiveQueryClient', () => { liveQueryClient._handleWebSocketError(error); }); - it('can handle WebSocket reconnect on error event', () => { + it('can handle WebSocket reconnect on error event', async () => { const liveQueryClient = new LiveQueryClient({ applicationId: 'applicationId', serverURL: 'ws://test', @@ -764,7 +773,12 @@ describe('LiveQueryClient', () => { expect(error).toEqual(data.error); }); const spy = jest.spyOn(liveQueryClient, '_handleReconnect'); - liveQueryClient._handleWebSocketMessage(event); + try { + liveQueryClient._handleWebSocketMessage(event); + await liveQueryClient.connectPromise; + } catch (e) { + expect(e.message).toBe('Additional properties not allowed'); + } expect(isChecked).toBe(true); expect(liveQueryClient._handleReconnect).toHaveBeenCalledTimes(1);