Skip to content

Commit 4ce76d6

Browse files
authored
Merge pull request #77 from Rich-Harris/node-20
add node 18/20 to test matrix, fix bad error in node 20
2 parents 50af63e + d67d05b commit 4ce76d6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
node-version: [16]
21+
node-version: [16, 18, 20]
2222
os: [ubuntu-latest]
2323
steps:
2424
- run: git config --global core.autocrlf false

test/test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class Custom {
99
}
1010
}
1111

12+
const node_version = +process.versions.node.split('.')[0];
13+
1214
const fixtures = {
1315
basics: [
1416
{
@@ -475,7 +477,10 @@ const invalid = [
475477
{
476478
name: 'invalid JSON',
477479
json: '][',
478-
message: 'Unexpected token ] in JSON at position 0'
480+
message:
481+
node_version >= 20
482+
? `Unexpected token ']', "][" is not valid JSON`
483+
: 'Unexpected token ] in JSON at position 0'
479484
},
480485
{
481486
name: 'hole',
@@ -518,7 +523,13 @@ for (const { name, json, message } of invalid) {
518523
uvu.test(`parse error: ${name}`, () => {
519524
assert.throws(
520525
() => parse(json),
521-
(error) => error.message === message
526+
(error) => {
527+
const match = error.message === message;
528+
if (!match) {
529+
console.error(`Expected: ${message}, got: ${error.message}`);
530+
}
531+
return match;
532+
}
522533
);
523534
});
524535
}

0 commit comments

Comments
 (0)