From 738aa304b37283ee1a123b4000763bc92fac6827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 7 Jul 2023 11:42:05 +0200 Subject: [PATCH] test: adapt REPL test to V8 changes Syntax errors from `JSON.parse` contain more information and can now be printed on two lines if they are long. PR-URL: https://github.com/nodejs/node/pull/49639 Reviewed-By: Jiawen Geng Reviewed-By: Rafael Gonzaga Reviewed-By: Antoine du Hamel --- test/parallel/test-repl.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 74299d4b4cbad5..98a0bc79c64d91 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -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 @@ -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