Skip to content
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

node-jscover: nodejs version of JSCover #132

Closed
yiminghe opened this issue May 21, 2014 · 3 comments
Closed

node-jscover: nodejs version of JSCover #132

yiminghe opened this issue May 21, 2014 · 3 comments
Assignees

Comments

@yiminghe
Copy link

Hi:
This library is great, especially the interesting front-end part. But I prefer a javascript version of coverage tool to instrument itself. So I reimplement your algorithm in nodejs at: https://github.com/yiminghe/node-jscover.

However, there are two points i do not understand:

  1. what does getLinePosition of BranchInstrumentor.java mean? I simply return ast node's column information, but it seems node-jscover is not always generating the same code as JSCover on this aspect.
  2. condition expression is not instrumented using JSCover, for example:
var x= y? 1:2;

after instrumented by JSCover

var x = y?1:2;

after instrumented by node-jscover

var x = visited(y)?1:2;
@tntim96 tntim96 self-assigned this May 21, 2014
@tntim96
Copy link
Owner

tntim96 commented May 21, 2014

what does getLinePosition of BranchInstrumentor.java mean

It returns the number of characters into the line that the branch condition starts on. It is currently unused in JSCover.

condition expression is not instrumented using JSCover

Sure it is. Take a look at shouldWrapTernaryCondition in BranchInstrumentorIntegrationTest and the branch instrumentation section of the manual

@yiminghe
Copy link
Author

It returns the number of characters into the line that the branch condition starts on. It is currently unused in JSCover.

getLinePosition is same with column in esprima (http://esprima.org/demo/parse.html)? but i discovered getLinePosition is not always same as column.

Sure it is. Take a look at shouldWrapTernaryCondition in BranchInstrumentorIntegrationTest and the branch instrumentation section of the manual

I mean JSCover does not instrument, maybe a bug

var x = y?1:2;

not

var x=y>0?1:2;

@tntim96
Copy link
Owner

tntim96 commented May 22, 2014

I mean JSCover does not instrument (var x = y?1:2;), maybe a bug

You're right. I've fixed it and a couple of other similar problems - can you re-test? You can rebuild from trunk or download from here.

i discovered getLinePosition is not always same as column

That's why I'm not using it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants