Skip to content

Commit

Permalink
test: adapt REPL test to V8 changes
Browse files Browse the repository at this point in the history
Syntax errors from `JSON.parse` contain more information and
can now be printed on two lines if they are long.

PR-URL: #49639
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
targos committed Oct 10, 2023
1 parent de5c009 commit 738aa30
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/parallel/test-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ const errorTests = [
// should throw
{
send: 'JSON.parse(\'{invalid: \\\'json\\\'}\');',
expect: [/^Uncaught SyntaxError: /]
expect: [
'Uncaught:',
/^SyntaxError: /,
],
},
// End of input to JSON.parse error is special case of syntax error,
// should throw
Expand All @@ -220,7 +223,10 @@ const errorTests = [
// should throw
{
send: 'JSON.parse(\'{\');',
expect: [/^Uncaught SyntaxError: /]
expect: [
'Uncaught:',
/^SyntaxError: /,
],
},
// invalid RegExps are a special case of syntax error,
// should throw
Expand Down

0 comments on commit 738aa30

Please sign in to comment.