test: adapt test-repl-pretty-*stack to V8 changes

PR-URL: https://github.com/nodejs/node/pull/44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Michaël Zasso 2022-07-25 12:11:50 +02:00
parent 71c193e581
commit 96ef25793d
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
2 changed files with 24 additions and 12 deletions

View File

@ -24,10 +24,17 @@ function run({ command, expected }) {
});
r.write(`${command}\n`);
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!\')',

View File

@ -26,10 +26,17 @@ function run({ command, expected, ...extraREPLOptions }, i) {
r.write(`${command}\n`);
console.log(i);
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!\')',