As a developer
I want meaningful stack traces
So that I can quickly debug.
Right now, Istanbul seems to put the entire instrumented code on line 9 so every stack trace will point to line 9 which is not very useful. The first 8 lines seem to be setup code for tracking coverage
A quick win would be to preserve line numbers in the instrumented output. Another way would be to generate source maps.
Thoughts?
+1 for this. I've been digging through the code to see if it's a setting already, but to no avail.
:+1:
This probably needs source maps to do it correctly.
Same here.
Source map support would be awesome, not only to fix this bug.
I have not looked at source maps in any depth but I recall that one of the blockers for source map support is an assumption that istanbul makes when instrumenting the code. Which is that "there is exactly one file being covered". It pulls the coverage object for the file from the global object just once and writes to it.
Having to deal with source maps breaks this assumption because the mapping might point to different files in different parts of the same source (e.g. bundling use cases).
The instrumenter needs to be made more intelligent to handle this case but at the same time the instrumented code should not take a massive performance penalty for the common use case of one source per file.
is there a way to fix this?
+1
+1
+1
:+1:
:+1:
:+1:
+1
:+1:
:+1:
+1
+1
+1
+1
This should be labelled as _bug_, not as _enhancement_ (imo :smile:)
I hear you guys. The next version of istanbul will have some support to fix this. I'm in the middle of some surgery so this is not a small addon to the current codebase.
:+1:
+1
+1
+1
+1
+1
+1
+1
Can we please stop with the +1s? They are pointless and cause spam to those of us who are interested in this issue.
If you want to watch this issue then please use the Subscribe button on the right. If you want just want to +1, then use the reaction that can be found near the bottom of the original post.
Yeah ok, but this is an issue open almost 2 years ago and it's rather important
two and a half years...
You should take a look at nyc. It's the new Istanbul command line interface and, from what I can tell, supports sourcemaps.
Unfortunately it seems that nyc is waiting for istanbul to support source maps, see issue #231 at nyc
The README mentions source map support and that issue is fairly old and closed. I haven't checked to make sure they are working as expected, but it would be worth a try.
Closing this as I've switched to using nyc and it supports source maps.
Most helpful comment
Can we please stop with the +1s? They are pointless and cause spam to those of us who are interested in this issue.
If you want to watch this issue then please use the Subscribe button on the right. If you want just want to +1, then use the reaction that can be found near the bottom of the original post.