From bfc6bb7b1d9576390e6818e9106288f9a84ea117 Mon Sep 17 00:00:00 2001 From: Steven John Lange Date: Sat, 17 Jun 2023 18:24:57 +0200 Subject: [PATCH 01/14] update ci workflow node environments --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c0c351c4e..f306e207b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ on: branches: [master] env: - NODE_VERSION: 14 + NODE_VERSION: 16 SELENIUM_HUB_HOST: hub TEST_HOST: localhost @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: couchdb: ['2.3', '3.1'] - node: [14, 16] + node: [16, 18, 20] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test @@ -123,7 +123,7 @@ jobs: strategy: fail-fast: false matrix: - node: [14, 16] + node: [16, 18, 20] adapter: ['leveldb', 'memory'] cmd: - npm test @@ -244,7 +244,7 @@ jobs: strategy: fail-fast: false matrix: - node: [14, 16] + node: [16, 18, 20] cmd: - CLIENT=selenium:firefox npm run test-webpack - AUTO_COMPACTION=true npm test From 60c4ac7c5e0b5302d11d147ce2d9c50ace3a1253 Mon Sep 17 00:00:00 2001 From: Steven John Lange Date: Tue, 25 Jul 2023 01:00:31 +0200 Subject: [PATCH 02/14] chore: reduce quotation noise in PR --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 808929bb3e..3eb25c24c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - couchdb: ["2.3", "3.1"] + couchdb: ['2.3', '3.1'] node: [16, 18, 20] cmd: - npm test @@ -75,8 +75,8 @@ jobs: strategy: fail-fast: false matrix: - couchdb: ["2.3", "3.1"] - client: ["firefox", "chromium"] + couchdb: ['2.3', '3.1'] + client: ['firefox', 'chromium'] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test @@ -116,7 +116,7 @@ jobs: fail-fast: false matrix: node: [16, 18, 20] - adapter: ["leveldb", "memory"] + adapter: ['leveldb', 'memory'] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find npm test @@ -151,8 +151,8 @@ jobs: strategy: fail-fast: false matrix: - client: ["firefox", "chromium"] - adapter: ["idb", "indexeddb", "memory"] + client: ['firefox', 'chromium'] + adapter: ['idb', 'indexeddb', 'memory'] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find npm test @@ -190,7 +190,7 @@ jobs: strategy: fail-fast: false matrix: - client: ["node", "firefox", "chromium"] + client: ['node', 'firefox', 'chromium'] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test From d7705de1d4b4d9fd1e4dc7abfef812b440189c1f Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Thu, 22 Feb 2024 16:22:58 +0100 Subject: [PATCH 03/14] add missing description fields to be GH action schema compliant --- .github/actions/install-deps/action.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index b946ea1bd7..b54aecfed7 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -1,8 +1,14 @@ name: Install dependencies +description: Intall dependencies to build and run PouchDB inputs: - node-version: { required: true } - couchdb-version: { required: false, default: '3.1' } + node-version: + required: true + description: Node.js version to install + couchdb-version: + description: CouchDB version to install + required: false + default: '3.1' runs: using: composite From 1e077f69f9241a56ad1d0ddbc38bd973627fc413 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Thu, 22 Feb 2024 16:24:21 +0100 Subject: [PATCH 04/14] update ci to cover active and lts versions of Node.js --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a08653ed6..aa071bc4a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ on: branches: [master] env: - NODE_VERSION: 16 + NODE_VERSION: 20 TEST_HOST: localhost jobs: @@ -44,7 +44,7 @@ jobs: fail-fast: false matrix: couchdb: ['2.3', '3.1'] - node: [16, 18, 20] + node: [18, 20, 21] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test @@ -122,7 +122,7 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 18, 20] + node: [18, 20, 21] adapter: ['leveldb', 'memory'] cmd: - npm test @@ -231,7 +231,7 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 18, 20] + node: [18, 20, 21] cmd: - CLIENT=firefox npm run test-webpack - AUTO_COMPACTION=true npm test From 5d50ee71e6a4df5dcfa2e3f9a3820b072c33c5f1 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Thu, 22 Feb 2024 16:46:07 +0100 Subject: [PATCH 05/14] more comments, even if the code is obvious --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa071bc4a0..3aa575986d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ env: TEST_HOST: localhost jobs: + + # Ensures code style compliance in JavaScript. + lint: runs-on: ubuntu-latest steps: @@ -27,6 +30,8 @@ jobs: node-version: ${{ env.NODE_VERSION }} - run: npm run eslint + # Check shell scripts. + shellcheck: runs-on: ubuntu-latest steps: From f4a8460f2ee61317e1fc19d82245f64c22ec4e7c Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Thu, 22 Feb 2024 16:49:26 +0100 Subject: [PATCH 06/14] revert couchdb-version description --- .github/actions/install-deps/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index b54aecfed7..0c6205761c 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -5,10 +5,7 @@ inputs: node-version: required: true description: Node.js version to install - couchdb-version: - description: CouchDB version to install - required: false - default: '3.1' + couchdb-version: { required: false, default: '3.1' } runs: using: composite From ba6b048696392cd915ec41b53f1c062dcd59586f Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Thu, 22 Feb 2024 17:03:57 +0100 Subject: [PATCH 07/14] revert comments in ci --- .github/actions/install-deps/action.yml | 5 +---- .github/workflows/ci.yml | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 0c6205761c..b946ea1bd7 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -1,10 +1,7 @@ name: Install dependencies -description: Intall dependencies to build and run PouchDB inputs: - node-version: - required: true - description: Node.js version to install + node-version: { required: true } couchdb-version: { required: false, default: '3.1' } runs: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aa575986d..c80eab3111 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,6 @@ env: jobs: - # Ensures code style compliance in JavaScript. - lint: runs-on: ubuntu-latest steps: @@ -30,8 +28,6 @@ jobs: node-version: ${{ env.NODE_VERSION }} - run: npm run eslint - # Check shell scripts. - shellcheck: runs-on: ubuntu-latest steps: From 666e65f664a3aafe7068921bcaaee1cc8e1f9e80 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 15:01:13 +0100 Subject: [PATCH 08/14] remove node 21 --- .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 c80eab3111..2fb937a3e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: couchdb: ['2.3', '3.1'] - node: [18, 20, 21] + node: [18, 20] cmd: - npm test - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test @@ -123,7 +123,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18, 20, 21] + node: [18, 20] adapter: ['leveldb', 'memory'] cmd: - npm test @@ -232,7 +232,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18, 20, 21] + node: [18, 20] cmd: - CLIENT=firefox npm run test-webpack - AUTO_COMPACTION=true npm test From 25cbdf7550063a5ac59c57bded7d5376273acde8 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 17:28:21 +0100 Subject: [PATCH 09/14] force CI run From a2807aacbbf92d9d9b8bee718b35b7179c8130cb Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 21:35:24 +0100 Subject: [PATCH 10/14] update test.changes.js --- tests/integration/test.changes.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/integration/test.changes.js b/tests/integration/test.changes.js index b2af267fec..eba808096d 100644 --- a/tests/integration/test.changes.js +++ b/tests/integration/test.changes.js @@ -361,25 +361,28 @@ adapters.forEach(function (adapter) { await testUtils.promisify(testUtils.writeDocs)(db, docs); - const caughtErrors = []; const changes = db.changes({ filter: 'foo/even', limit: 2, include_docs: true }); - changes.on('error', (err) => { - assert.equal( - err.status, - testUtils.errors.MISSING_DOC.status, - 'correct error status returned' - ); - assert.equal(err.name, 'not_found'); - caughtErrors.push(err); + const errorPromise = new Promise(function (resolve) { + const listener = (err) => { + changes.off('error', listener); + resolve(err); + }; + changes.on('error', listener); }); await assert.isRejected(changes, 'completes with an exception'); - assert.lengthOf(caughtErrors, 1, 'changes emitted the expected error'); + const caughtError = await errorPromise; + assert.equal( + caughtError.status, + testUtils.errors.MISSING_DOC.status, + 'correct error status returned' + ); + assert.equal(caughtError.name, 'not_found'); }); it('Changes limit and filter', function (done) { From 572d9bfceb8dd7d37318d16ce837f08f4ba90bd9 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 21:37:05 +0100 Subject: [PATCH 11/14] replace arrow function --- tests/integration/test.changes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test.changes.js b/tests/integration/test.changes.js index eba808096d..84e86cb008 100644 --- a/tests/integration/test.changes.js +++ b/tests/integration/test.changes.js @@ -368,7 +368,7 @@ adapters.forEach(function (adapter) { }); const errorPromise = new Promise(function (resolve) { - const listener = (err) => { + const listener = function (err) { changes.off('error', listener); resolve(err); }; From fcb3cd2e7878bd404620901fbf9775af13edb4d3 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 21:46:41 +0100 Subject: [PATCH 12/14] use once instead of on --- tests/integration/test.changes.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/integration/test.changes.js b/tests/integration/test.changes.js index 84e86cb008..a934559573 100644 --- a/tests/integration/test.changes.js +++ b/tests/integration/test.changes.js @@ -368,11 +368,9 @@ adapters.forEach(function (adapter) { }); const errorPromise = new Promise(function (resolve) { - const listener = function (err) { - changes.off('error', listener); + changes.once('error', function (err) { resolve(err); - }; - changes.on('error', listener); + }); }); await assert.isRejected(changes, 'completes with an exception'); From 075adaf15c7b1f5a723522df46a86042caeb2b2e Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Fri, 23 Feb 2024 22:06:00 +0100 Subject: [PATCH 13/14] fix: assert in event handler emitts outside test context --- tests/integration/test.changes.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/test.changes.js b/tests/integration/test.changes.js index a934559573..9630f43ab0 100644 --- a/tests/integration/test.changes.js +++ b/tests/integration/test.changes.js @@ -367,14 +367,14 @@ adapters.forEach(function (adapter) { include_docs: true }); - const errorPromise = new Promise(function (resolve) { - changes.once('error', function (err) { - resolve(err); - }); + const caughtErrors = []; + changes.on('error', function (err) { + caughtErrors.push(err); }); await assert.isRejected(changes, 'completes with an exception'); - const caughtError = await errorPromise; + assert.equal(caughtErrors.length, 1); + const caughtError = caughtErrors[0]; assert.equal( caughtError.status, testUtils.errors.MISSING_DOC.status, From c45459dd65b37ce88f42b56e1b056b09578e8c39 Mon Sep 17 00:00:00 2001 From: Steven-John Lange Date: Mon, 26 Feb 2024 15:09:48 +0100 Subject: [PATCH 14/14] Revert changes in test.changes.js --- tests/integration/test.changes.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/integration/test.changes.js b/tests/integration/test.changes.js index 9630f43ab0..b2af267fec 100644 --- a/tests/integration/test.changes.js +++ b/tests/integration/test.changes.js @@ -361,26 +361,25 @@ adapters.forEach(function (adapter) { await testUtils.promisify(testUtils.writeDocs)(db, docs); + const caughtErrors = []; const changes = db.changes({ filter: 'foo/even', limit: 2, include_docs: true }); - const caughtErrors = []; - changes.on('error', function (err) { + changes.on('error', (err) => { + assert.equal( + err.status, + testUtils.errors.MISSING_DOC.status, + 'correct error status returned' + ); + assert.equal(err.name, 'not_found'); caughtErrors.push(err); }); await assert.isRejected(changes, 'completes with an exception'); - assert.equal(caughtErrors.length, 1); - const caughtError = caughtErrors[0]; - assert.equal( - caughtError.status, - testUtils.errors.MISSING_DOC.status, - 'correct error status returned' - ); - assert.equal(caughtError.name, 'not_found'); + assert.lengthOf(caughtErrors, 1, 'changes emitted the expected error'); }); it('Changes limit and filter', function (done) {