Skip to content

Commit

Permalink
test: make the test compatible with Node 18 and 20 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
donwellus committed Apr 22, 2024
1 parent 0ba2e9f commit 0203d24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ test('null support', ({ same, plan }) => {
stream.end()
})

test('broken json', ({ same, plan }) => {
test('broken json', ({ match, same, plan }) => {
plan(2)
const expected = '{ "truncated'
const stream = build(function (source) {
source.on('unknown', function (line, error) {
same(expected, line)
same(error.message, 'Unexpected end of JSON input')
const regex = /^(Unexpected end of JSON input|Unterminated string in JSON at position 12)$/
match(error.message, regex)
})
})

Expand Down

0 comments on commit 0203d24

Please sign in to comment.