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 79e1831

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: make error stack test engine agnostic
Revise test-internal-util-decorate-error-stack so that it does not depend on behavior specific to V8. PR-URL: #16272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent b5b23bd commit 79e1831
Copy full SHA for 79e1831

File tree

Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-internal-util-decorate-error-stack.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-internal-util-decorate-error-stack.js
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ const obj = {};
2424
decorateErrorStack(obj);
2525
assert.strictEqual(obj.stack, undefined);
2626

27-
// Verify that the stack is decorated when possible
27+
// Verify that the stack is decorated when possible.
2828
function checkStack(stack) {
29-
const matches = stack.match(/var foo bar;/g);
30-
assert.strictEqual(Array.isArray(matches), true);
31-
assert.strictEqual(matches.length, 1);
29+
// Matching only on a minimal piece of the stack because the string will vary
30+
// greatly depending on the JavaScript engine. V8 includes `;` because it
31+
// displays the line of code (`var foo bar;`) that is causing a problem.
32+
// ChakraCore does not display the line of code but includes `;` in the phrase
33+
// `Expected ';' `.
34+
assert.ok(/;/g.test(stack));
35+
// Test that it's a multiline string.
36+
assert.ok(/\n/g.test(stack));
3237
}
3338
let err;
3439
const badSyntaxPath =

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.