diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f421f0..2edff8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16] + node-version: [16, 18, 20] os: [ubuntu-latest] steps: - run: git config --global core.autocrlf false diff --git a/test/test.js b/test/test.js index afe3557..8d336a2 100644 --- a/test/test.js +++ b/test/test.js @@ -9,6 +9,8 @@ class Custom { } } +const node_version = +process.versions.node.split('.')[0]; + const fixtures = { basics: [ { @@ -475,7 +477,10 @@ const invalid = [ { name: 'invalid JSON', json: '][', - message: 'Unexpected token ] in JSON at position 0' + message: + node_version >= 20 + ? `Unexpected token ']', "][" is not valid JSON` + : 'Unexpected token ] in JSON at position 0' }, { name: 'hole', @@ -518,7 +523,13 @@ for (const { name, json, message } of invalid) { uvu.test(`parse error: ${name}`, () => { assert.throws( () => parse(json), - (error) => error.message === message + (error) => { + const match = error.message === message; + if (!match) { + console.error(`Expected: ${message}, got: ${error.message}`); + } + return match; + } ); }); }