From 96ef25793dd9ffed3e863c71893e698fc614a039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 25 Jul 2022 12:11:50 +0200 Subject: [PATCH] test: adapt test-repl-pretty-*stack to V8 changes PR-URL: https://github.com/nodejs/node/pull/44741 Reviewed-By: Ben Noordhuis Reviewed-By: Jiawen Geng Reviewed-By: James M Snell --- test/parallel/test-repl-pretty-custom-stack.js | 18 ++++++++++++------ test/parallel/test-repl-pretty-stack.js | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-repl-pretty-custom-stack.js b/test/parallel/test-repl-pretty-custom-stack.js index aef34f1b4f6329..a10cd032a688c4 100644 --- a/test/parallel/test-repl-pretty-custom-stack.js +++ b/test/parallel/test-repl-pretty-custom-stack.js @@ -24,10 +24,17 @@ function run({ command, expected }) { }); r.write(`${command}\n`); - assert.strictEqual( - accum.replace(stackRegExp, '$1:*:*'), - expected.replace(stackRegExp, '$1:*:*') - ); + if (typeof expected === 'string') { + assert.strictEqual( + accum.replace(stackRegExp, '$1:*:*'), + expected.replace(stackRegExp, '$1:*:*') + ); + } else { + assert.match( + accum.replace(stackRegExp, '$1:*:*'), + expected + ); + } r.close(); } @@ -53,8 +60,7 @@ const tests = [ }, { command: 'let x y;', - expected: 'let x y;\n ^\n\n' + - 'Uncaught SyntaxError: Unexpected identifier\n' + expected: /let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/ }, { command: 'throw new Error(\'Whoops!\')', diff --git a/test/parallel/test-repl-pretty-stack.js b/test/parallel/test-repl-pretty-stack.js index c785bf75a15ba6..2aad0e09b6d9ba 100644 --- a/test/parallel/test-repl-pretty-stack.js +++ b/test/parallel/test-repl-pretty-stack.js @@ -26,10 +26,17 @@ function run({ command, expected, ...extraREPLOptions }, i) { r.write(`${command}\n`); console.log(i); - assert.strictEqual( - accum.replace(stackRegExp, '$1*:*'), - expected.replace(stackRegExp, '$1*:*') - ); + if (typeof expected === 'string') { + assert.strictEqual( + accum.replace(stackRegExp, '$1*:*'), + expected.replace(stackRegExp, '$1*:*') + ); + } else { + assert.match( + accum.replace(stackRegExp, '$1*:*'), + expected + ); + } r.close(); } @@ -43,8 +50,7 @@ const tests = [ }, { command: 'let x y;', - expected: 'let x y;\n ^\n\n' + - 'Uncaught SyntaxError: Unexpected identifier\n' + expected: /^let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/ }, { command: 'throw new Error(\'Whoops!\')',