File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,16 @@ const obj = {};
24
24
decorateErrorStack ( obj ) ;
25
25
assert . strictEqual ( obj . stack , undefined ) ;
26
26
27
- // Verify that the stack is decorated when possible
27
+ // Verify that the stack is decorated when possible.
28
28
function checkStack ( stack ) {
29
- const matches = stack . match ( / v a r f o o b a r ; / 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 ) ) ;
32
37
}
33
38
let err ;
34
39
const badSyntaxPath =
You can’t perform that action at this time.
0 commit comments