| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b5b23bd commit 79e1831
1 file 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(/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)); | ||
| 32 | 37 | } | |
| 33 | 38 | let err; | |
| 34 | 39 | const badSyntaxPath = | |
| Back | FazBrowse Home | New Git URL |
0 commit comments