Refactor stack trace formatter and add unit tests#2920
Merged
johnsimons merged 5 commits intofix/stacktrace-formatter-regexfrom Mar 25, 2026
Merged
Refactor stack trace formatter and add unit tests#2920johnsimons merged 5 commits intofix/stacktrace-formatter-regexfrom
johnsimons merged 5 commits intofix/stacktrace-formatter-regexfrom
Conversation
Extract formatting logic from the Vue component into a dedicated TypeScript module to improve maintainability and enable unit testing. Includes a comprehensive test suite covering multiple languages and regression tests for exception message parsing.
5 tasks
The regex capture group always returns a string, but the interface declared lineNumber as number. This caused a silent type lie that the type assertion masked.
Splitting an empty string on ", " produces [""], resulting in a
bogus { type: "", name: undefined } param for no-argument methods.
Guard with a falsy check so params is an empty array instead.
The <StackTraceFrame> assertion bypassed structural checking, which masked the lineNumber type mismatch. Using satisfies lets TypeScript verify the object literal against the interface.
The regression comment incorrectly claimed 'at' matched inside words like 'that'; the actual bug was an unanchored regex. The edge case comment implied leading-whitespace was a fix when it was always the existing behavior.
dvdstelt
approved these changes
Mar 25, 2026
johnsimons
commented
Mar 25, 2026
| params: Array<{ name: string; type: string }>; | ||
| type: string; | ||
| lineNumber?: number; | ||
| lineNumber?: string; |
Member
Author
There was a problem hiding this comment.
@dvdstelt are you sure about this? Because currently, lineNumber is a number in the code in the main branch!
Member
Author
There was a problem hiding this comment.
I see, you changed to use satisfies and hence the need to change this.
And it doesn't really make much of a difference.
e6cdf9d
into
fix/stacktrace-formatter-regex
3 of 5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extract formatting logic from the Vue component into a dedicated TypeScript module to improve maintainability and enable unit testing. Includes a comprehensive test suite covering multiple languages and regression tests for exception message parsing.
Reviewer Checklist