jeffrifwald / babel-istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
144 stars 23 forks source link

Windows coverage reported as 100% #26

Closed ghost closed 8 years ago

ghost commented 8 years ago

On Windows the file paths are not parsed correctly. Thus all coverage is reported as 100% for all files. This can be fixed by converting Windows path separator \ (previously converted to ) into*nix separator /.

The previous change breaks the summarizer, which does not group files under the same path anymore and shows full paths for all files. This can be fixed by making the converter use *nix separator / only.

This change does not break any additional tests. In my environments and Travis, some tests are broken regardless. If this is not intentional, I would appreciate an environment setup instructions in the documentation.

jeffrifwald commented 8 years ago

@jhytonen Does plain istanbul work for you? This looks like an istanbul specific issue.

ghost commented 8 years ago

@jmcriffey I will try with plain Istanbul and get back to you.

ghost commented 8 years ago

@jmcriffey I tried with istanbul 0.4.0 and babel-istanbul 0.3.20. I ran [babel-]istanbul cover test/run.js for the master of babel-istanbul project.

As far as I can see, istanbul reports correctly, whereas babel-istabul doesn't.

babel-istanbul: babel-istanbul

istanbul: istanbul

jeffrifwald commented 8 years ago

I'm still unclear about the issue here. I wouldn't try running the babel-istanbul tests, as they are likely broken. Try running coverage on something else to test this out. I'm very confused as to why this would be a babel-istanbul issue.

If there really is an issue here, I'm really weary of simply replacing the separator. There is likely a reason for the separators being setup as they are. I'll see if I can do some testing in a windows environment.

jeffrifwald commented 8 years ago

@jhytonen Alright I've tracked this down as an istanbul specific issue. It was fixed in a version later than babel-istanbul is up to date with. I'll try upgrading to the newest version of istanbul and we can see if that fixes your issue.

jeffrifwald commented 8 years ago

@jhytonen Try babel-istanbul 0.4.0 from npm and let me know if that fixes your issue. Thanks.

ghost commented 8 years ago

@jmcriffey Nope, 0.4.0 does not fix the issue. The results are exactly the same. Could you please reference the istanbul-specific issue that you mentioned? I can then have a look at that.

jeffrifwald commented 8 years ago

Here is the istanbul issue with several related sub issues:

https://github.com/gotwarlost/istanbul/issues/79

I'm not sure how this can still be a problem if you are using babel-istanbul 0.4.0 as it handles paths exactly the same as istanbul 0.4.0 now. There simply is no longer any difference in how paths are handled for istanbul and babel-istanbul.

Could you double check that you get certain coverage in instanbul 0.4.0 and then confirm you don't get the correct coverage with babel-istanbul 0.4.0?