diff --git a/test/parallel/test-repl-pretty-custom-stack.js b/test/parallel/test-repl-pretty-custom-stack.js index aef34f1b4f6..a10cd032a68 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 c785bf75a15..2aad0e09b6d 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!\')',