-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong ranges #44
Comments
this is a bug with the header not being removed, because of a breaking change in Node.js around module naming; it will be fixed in future node versions when wrapping behavior changes — the 62 characters is module.wrap not being removed from the offsets. |
Thanks! I got it! So it takes 62 characters, and I should simply always (until fixed node versions) subtract this number to get real offsets! Cool! |
I'm closing this because Node.js v12 has been released. If you still run into this problem even if you use Node.js v12, feel free to comment more here. |
Not necessarily relates to c8, but I was asked to create an issue here.
I have general struggle with coverage features in node.js.
I tried using c8 package and node.js' inspector module.
Neither of them gives correct
lineNumber
,columnNumber
andranges
(startOffset
,endOffset
), unfortunately.c8
when I run
c8 node test.js
where test.js is this file:I get this in the generated report:
Note the
startOffset":62
when there is 44 characters total intest.js
. I am not even speaking about"endOffset":99
.inspector
after not successing with c8 I tried to place in my test.js code from this example
and run
node test.js
then I got this:
Note the
"lineNumber":5
when there is no anything on line number 5!Then @bcoe gave me an advice to take into accunt
require('module').wrapper[0]
that is inserted by node.js. But if done so, line number 5 containssession.connect
and notsession.post
(see the json above)!My setup:
Linux (Lubuntu).
Node 11.2.0 (also tested in 10.13.0 with the same results)
c8 3.2.1
The text was updated successfully, but these errors were encountered: