Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add node 18/20 to test matrix, fix bad error in node 20 #77

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Custom {
}
}

const node_version = +process.versions.node.split('.')[0];

const fixtures = {
basics: [
{
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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;
}
);
});
}
Expand Down
Loading