Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96ef257

Browse filesBrowse files
committed
test: adapt test-repl-pretty-*stack to V8 changes
PR-URL: #44741 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 71c193e commit 96ef257
Copy full SHA for 96ef257

File tree

Expand file treeCollapse file tree

2 files changed

+24
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-12
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-repl-pretty-custom-stack.js
+12-6Lines changed: 12 additions & 6 deletions
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!\')',
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-repl-pretty-stack.js
+12-6Lines changed: 12 additions & 6 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.