Skip to content

Commit 96ef257

Browse files
committed
test: adapt test-repl-pretty-*stack to V8 changes
PR-URL: #44741 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 71c193e commit 96ef257

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

test/parallel/test-repl-pretty-custom-stack.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ function run({ command, expected }) {
2424
});
2525

2626
r.write(`${command}\n`);
27-
assert.strictEqual(
28-
accum.replace(stackRegExp, '$1:*:*'),
29-
expected.replace(stackRegExp, '$1:*:*')
30-
);
27+
if (typeof expected === 'string') {
28+
assert.strictEqual(
29+
accum.replace(stackRegExp, '$1:*:*'),
30+
expected.replace(stackRegExp, '$1:*:*')
31+
);
32+
} else {
33+
assert.match(
34+
accum.replace(stackRegExp, '$1:*:*'),
35+
expected
36+
);
37+
}
3138
r.close();
3239
}
3340

@@ -53,8 +60,7 @@ const tests = [
5360
},
5461
{
5562
command: 'let x y;',
56-
expected: 'let x y;\n ^\n\n' +
57-
'Uncaught SyntaxError: Unexpected identifier\n'
63+
expected: /let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/
5864
},
5965
{
6066
command: 'throw new Error(\'Whoops!\')',

test/parallel/test-repl-pretty-stack.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ function run({ command, expected, ...extraREPLOptions }, i) {
2626

2727
r.write(`${command}\n`);
2828
console.log(i);
29-
assert.strictEqual(
30-
accum.replace(stackRegExp, '$1*:*'),
31-
expected.replace(stackRegExp, '$1*:*')
32-
);
29+
if (typeof expected === 'string') {
30+
assert.strictEqual(
31+
accum.replace(stackRegExp, '$1*:*'),
32+
expected.replace(stackRegExp, '$1*:*')
33+
);
34+
} else {
35+
assert.match(
36+
accum.replace(stackRegExp, '$1*:*'),
37+
expected
38+
);
39+
}
3340
r.close();
3441
}
3542

@@ -43,8 +50,7 @@ const tests = [
4350
},
4451
{
4552
command: 'let x y;',
46-
expected: 'let x y;\n ^\n\n' +
47-
'Uncaught SyntaxError: Unexpected identifier\n'
53+
expected: /^let x y;\n {6}\^\n\nUncaught SyntaxError: Unexpected identifier.*\n/
4854
},
4955
{
5056
command: 'throw new Error(\'Whoops!\')',

0 commit comments

Comments
 (0)