stacktracejs / error-stack-parser

Extract meaning from JS Errors
https://www.stacktracejs.com/#!/docs/error-stack-parser
MIT License
456 stars 52 forks source link

Inaccurate filename extracted from Error generated from Zone.js Proxy #44

Open YoungCatChen opened 6 years ago

YoungCatChen commented 6 years ago

Consider this error stack:

Error
    at StackTrace$$GenerateError (http://concatjs/base/third_party/javascript/cucumber_js/cucumber.js:54957:19) [ProxyZone]
    at Object.StackTrace$$getSync [as getSync] (http://concatjs/base/third_party/javascript/cucumber_js/cucumber.js:55019:23) [ProxyZone]

The error-stack-parser library finds the wrong location.

Expected Behavior

The location should be http://.../cucumber.js:54957:19.

Current Behavior

The location it finds is [ProxyZone].

Steps to Reproduce (for bugs)

<Working on a repro; but let me know if you don't need one.>

Context

I'm trying to use CucumberJS for my Angular2+ app's testing framework. CucumberJS uses this library to find relevant information of where a step is defined. Angular2+ app may be run under Zone.js, which may use its Proxy to do some stuff.

Your Environment

Possible Solution

I'm not an export, but I guess this thing tokens.pop() may be the culprit:

https://github.com/stacktracejs/error-stack-parser/blob/2d84c602aeb2182544e4e5cc65add13d990473de/error-stack-parser.js#L62