-
Notifications
You must be signed in to change notification settings - Fork 20
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
Deprecate in favor of istanbul report #2
Comments
The one thing |
You should be able to do I'm not entirely sure how karma lays out the files. As I recall there was a subdirectory for each browser, with a coverage.json in the folder. You should be able to figure out a pattern that works. |
Note that karma has an issue that may make it difficult to combine files generated by Karma with non Karma sources. |
That defines the path to the coverage files, not a basePath to prepend to all the files within the coverage files. With karma-coverage, you can specify a basePath to your source, but when it outputs the reports, they dont include this basePath. Therefore, when
|
Right, per the issue I reference above, karma is doing it wrong. The Istanbul spec calls for paths to be absolute. For some reason, I wrote this tool to combine reports from karma and non-karma tests. But before I understood how karma was breaking the coverage reports. This whole library is basically a bandaid for a karma bug. Once my PR gets merged into |
OK, @erindru |
Yep, the 0.5.0 version of |
FWIW I wrote a tiny grunt plugin https://github.com/yomed/grunt-istanbul-combine because I couldn't seem to get grunt-istanbul to combine reports. Could be my own error, but this package did turn out to be useful... |
Cool. You should do it this way:
If that doesn't work for you, we should file an issue with istanbul or grunt-istanbul. Either way. That's a lot of steps, so there's probably still utility for something like your plugin (even if this module is ultimately deprecated). |
I have a big pipeline with separated unit tests and functional tests, so the unit coverage is measured with just mocha+istanbul, and the functional coverage needs karma in there. So all of the coverage is already handled, and I literally just need to merge two reports together. I tried using grunt-istanbul for the |
What version of karma are you running? (istanbul-combine is definitely required if you are using < 0.5.0) |
For some reason istanbul report fails with unknown error when trying to comobine two reports. Howver istanbul-combine works perfectly. |
@SirmaITT Can you provide an example of how you are trying to use |
I have two reports - one made by karma and one made by protractor (i manually instrument the code before running the protractor tests). node ./node_modules/.bin/istanbul report --include=reports/*/coverage.json -d overall_coverage lcov |
Are you using all the latest versions (karma, karma-coverage plugin, and istanbul?) |
I use "istanbul": "gotwarlost/istanbul.git#source-map" (the source-map branch) |
Try with standard istanbul and see if you can get it to work. Also, just for my curiosity, does the souremap branch make a big improvement? |
Big improvement in which direction? I have the coverage + source maps working. |
Why are you using coverage + source maps? |
I'm using it to get a nice report where i can see the coverage on my original (non-transpiled) code. |
Ohhh. It didn't do that already? |
No. But you can track the progress here - gotwarlost/istanbul#212 |
Tried a dozen variations of this, with no luck: report -v --include coverage/*.json --dir coverage-output json I have a coverage directory containing two .json files which were generated with the latest version of karma. I'm getting the same error as here: gotwarlost/istanbul#403 My json files have absolute paths, not relative. I posted there as well, but this project seems more active, and I'm wondering if anyone else has come across that error and found a workaround. |
@jamestalmage FYI I've since moved to using istanbul directly for the reporting as you suggested, but my karma reports mysteriously have relative paths instead of absolute paths (despite being on the latest versions of |
@jamestalmage Does this work with plain "istanbul" for you already with istanbul v0.4? I tried upgrading to istanbul 1.1-alpha but then had issues with the format being reported as wrong. (Maybe due to my karma setup still using istanbul 0.4 for reporting), but maybe it's just the bug that @richardm linked. Anyway, since I integrated this project, I was finally able to get combined coverage across ava and karma tests :-) So I feel there is definitely in this at the moment! |
istanbul report works as expected |
FYI with latest Istanbul, I no longer needed this library. Was successfully able to merge coverage reports from karma and jest. |
istanbul-combine is no longer necessary, since `istanbul report` does the same thing: jamestalmage/istanbul-combine#2 This change replaces the `istanbul-combine` command with `istanbul report`. By default, it uses `**/coverage.json` as the input (which automatically matches coverage/{unit,safe}/coverage.json). The default output is `coverage/`, which is now left as default for simplicity. Thus the upload script is changed to upload from `coverage/lcov.info` instead of `coverage/combine/lcov.info`. Lastly, the `test:cover` script is split so that its role is strictly to generate the coverage data. The "post"-test:cover script is responsible for generating the report. (post script used directly, rather than adding indirection for a test:cover:report script, since it would rarely be run directly.)
It looks like this is probably an unnecessary module, and that
istanbul report json
will do the same thing:The text was updated successfully, but these errors were encountered: