From f87b412ad5e978f91fe6336e8c9b6547db4508d1 Mon Sep 17 00:00:00 2001 From: Morgan Martinet Date: Sun, 22 Sep 2024 12:03:17 -0400 Subject: [PATCH] do not fix sqlite and adapt unit tests --- .github/workflows/build.yaml | 3 --- .github/workflows/npm-publish.yml | 4 ---- src/sorter.test.ts | 22 +++++++++++++++------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 91cd648..d17052f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,9 +18,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - - run: sudo apt update - - run: sudo apt install sqlite3=3.43.2 - - run: sqlite3 --version - run: npm ci - run: npm test env: diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 93a3a1b..511babf 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -27,10 +27,6 @@ jobs: with: node-version: 20 registry-url: https://registry.npmjs.org/ - - name: setup-sqlite-action - uses: ryohidaka/action-setup-sqlite@v1.1.0 - with: - version: 3.43.2 - run: npm ci - run: npm run compile - run: npm publish --access=public diff --git a/src/sorter.test.ts b/src/sorter.test.ts index 4421677..95c84fb 100644 --- a/src/sorter.test.ts +++ b/src/sorter.test.ts @@ -54,13 +54,21 @@ describe('Sorter', () => { orderBy: [{ name: 'id' }], logger: (msg) => { logs.push(msg); }, }, script); - }).rejects.toThrow(`Parse error near line 1: no such function: unknownfunc`); - expect(logs).toEqual([ - '[SQLite] Parse error near line 1: no such function: unknownfunc', - '[SQLite] select unknownfunc(1);', - '[SQLite] ^--- error here', - '[SQLite] ' - ]); + }).rejects.toThrow(`no such function: unknownfunc`); + if (logs.some(x => x.includes('^--- error here'))) { + // The latest version of SQLite3 enhanced error reporting + expect(logs).toEqual([ + '[SQLite] Parse error near line 1: no such function: unknownfunc', + '[SQLite] select unknownfunc(1);', + '[SQLite] ^--- error here', + '[SQLite] ' + ]); + } else { + expect(logs).toEqual([ + '[SQLite] Error: near line 1: in prepare, no such function: unknownfunc (1)', + '[SQLite] ' + ]); + } }); test('should fail with unknown sqlite command', async () => { await expect(async () => {