Fail to parseLine when path contains '('
Closed this issue · 2 comments
Example:
stackUtils.parseLine(' at Context.<anonymous> (/Users/USER/Dropbox (Personal)/example/test.js:14:11)')
// => null
stackUtils.parseLine(' at Context.<anonymous> (/Users/USER/Dropbox/example/test.js:14:11)')
// => { line: 14, column: 11, file: '/Users/USER/Dropbox/example/test.js', function: 'Context.<anonymous>' }
Looking at the possible permutations I am not very confident in my ability to get a patch implemented 😟 Possibly someone with more experience would have time to look at this?
Additionally, I hit this issue trying to utilize another library as well (stack-trace). I wonder if the parseLine functionality could be pulled out and utilized by both libraries in order to maximize reuse, improve consistency, and share workload? Just a thought.
The very well may be naive, but changing the matching pattern for location to not negate the )
character appears to fix my issue while not breaking any of the existing tests.
line 215:
before: '(?:eval at ([^ ]+) \\(([^\\)]+):(\\d+):(\\d+)\\), )?' +
after: '(?:eval at ([^ ]+) \\((.+):(\\d+):(\\d+)\\), )?' +
line 219:
before: '(?:([^\\)]+):(\\d+):(\\d+)|(native))' +
after: '(?:(.+):(\\d+):(\\d+)|(native))' +
However, negating the character appears to have been a very intentional choice. I am assuming there is a missing testcase for this requirement?
Actually creating a PR would allow easier review than trying to put the changes in a comment.
The issue seems legit. Start a PR with your proposed changes, and we can debate from there.