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:
parent
71c193e581
commit
96ef25793d
@ -24,10 +24,17 @@ function run({ command, expected }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
r.write(`${command}\n`);
|
r.write(`${command}\n`);
|
||||||
|
if (typeof expected === 'string') {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
accum.replace(stackRegExp, '$1:*:*'),
|
accum.replace(stackRegExp, '$1:*:*'),
|
||||||
expected.replace(stackRegExp, '$1:*:*')
|
expected.replace(stackRegExp, '$1:*:*')
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
assert.match(
|
||||||
|
accum.replace(stackRegExp, '$1:*:*'),
|
||||||
|
expected
|
||||||
|
);
|
||||||
|
}
|
||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,8 +60,7 @@ const tests = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'let x y;',
|
command: 'let x y;',
|
||||||
expected: 'let x y;\n ^\n\n' +
|
expected: /let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/
|
||||||
'Uncaught SyntaxError: Unexpected identifier\n'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'throw new Error(\'Whoops!\')',
|
command: 'throw new Error(\'Whoops!\')',
|
||||||
|
@ -26,10 +26,17 @@ function run({ command, expected, ...extraREPLOptions }, i) {
|
|||||||
|
|
||||||
r.write(`${command}\n`);
|
r.write(`${command}\n`);
|
||||||
console.log(i);
|
console.log(i);
|
||||||
|
if (typeof expected === 'string') {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
accum.replace(stackRegExp, '$1*:*'),
|
accum.replace(stackRegExp, '$1*:*'),
|
||||||
expected.replace(stackRegExp, '$1*:*')
|
expected.replace(stackRegExp, '$1*:*')
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
assert.match(
|
||||||
|
accum.replace(stackRegExp, '$1*:*'),
|
||||||
|
expected
|
||||||
|
);
|
||||||
|
}
|
||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +50,7 @@ const tests = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'let x y;',
|
command: 'let x y;',
|
||||||
expected: 'let x y;\n ^\n\n' +
|
expected: /^let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/
|
||||||
'Uncaught SyntaxError: Unexpected identifier\n'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'throw new Error(\'Whoops!\')',
|
command: 'throw new Error(\'Whoops!\')',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user