| 30 | const col = 45; |
| 31 | |
| 32 | function getValidStackFrames(prefix: string, uri: string, withLineCol: boolean): string[] { |
| 33 | const frames = withLineCol |
| 34 | ? [ |
| 35 | // Dart/Flutter |
| 36 | `${prefix}(${uri}:${line}:${col})`, |
| 37 | `${prefix}(${uri}:${line}:${col}))`, // This extra closing paren exists in Dart stacks 🤷♂️ |
| 38 | // Flutter web |
| 39 | `${uri} ${line}:${col} ${prefix}`, |
| 40 | ] |
| 41 | : [ |
| 42 | // Dart/Flutter |
| 43 | `${prefix}(${uri})`, |
| 44 | `${prefix}(${uri}))`, // This extra closing paren exists in Dart stacks 🤷♂️ |
| 45 | // Flutter web |
| 46 | `${uri} ${prefix}`, |
| 47 | ]; |
| 48 | |
| 49 | // Assertion failure |
| 50 | if (!prefix) { |
| 51 | if (withLineCol) |
| 52 | frames.push(`'${uri}': Failed assertion: line ${line} pos ${col}: '!keyReservation.contains(key)': is not true.`); |
| 53 | else |
| 54 | frames.push(`'${uri}': Failed assertion: '!keyReservation.contains(key)': is not true.`); |
| 55 | } |
| 56 | |
| 57 | return frames; |
| 58 | } |
| 59 | |
| 60 | describe("stack trace parser", () => { |
| 61 | it(`parses strings over ${maxStackFrameMessageLength} characters quickly`, () => { |