From a33a2e1910d73fe0eec6248eb415b202aaf267c2 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 20 Feb 2024 10:26:54 +0100 Subject: [PATCH] test: test with node 20 --- .github/workflows/autofix.yml | 8 ++++---- .github/workflows/ci.yml | 2 +- test/index.test.ts | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index c913222..37e5760 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -1,9 +1,9 @@ -name: autofix.ci # needed to securely identify the workflow +name: autofix.ci # needed to securely identify the workflow on: pull_request: push: - branches: [ "main" ] + branches: ["main"] permissions: contents: read @@ -16,11 +16,11 @@ jobs: - run: corepack enable - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: "pnpm" - run: pnpm install - name: Fix lint issues run: pnpm run lint:fix - uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84 with: - commit-message: 'chore: apply automated lint fixes' + commit-message: "chore: apply automated lint fixes" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42e6954..cf8f49b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - run: corepack enable - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: "pnpm" - run: pnpm install - run: pnpm lint diff --git a/test/index.test.ts b/test/index.test.ts index 527a400..2d77bde 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -143,20 +143,22 @@ describe("destr", () => { } }); - it("throws an error if it's a invalid JSON texts with safeDestr", () => { + describe("throws an error if it's a invalid JSON texts with safeDestr", () => { const testCases = [ - { input: "{ ", output: "Unexpected end of JSON input" }, + { input: "{ ", output: "Expected property name or" }, { input: "[ ", output: "Unexpected end of JSON input" }, - { input: '" ', output: "Unexpected end of JSON input" }, - { input: "[1,2,3]?", output: "Unexpected token" }, + { input: '" ', output: "Unterminated string in JSON at position" }, + { input: "[1,2,3]?", output: "Unexpected non-whitespace character" }, { input: "invalid JSON text", output: "Invalid JSON" }, - { input: ' "Invalid', output: "Unexpected end of JSON input" }, + { input: ' "Invalid', output: "Unterminated string in JSON at position" }, ]; for (const testCase of testCases) { - expect(() => safeDestr(testCase.input)).toThrowError( - testCase.output || "", - ); + it(testCase.input, () => { + expect(() => safeDestr(testCase.input)).toThrowError( + testCase.output || "", + ); + }); } });