SonarTSPlugin does not show the coverage information in the LCOV file #48
Comments
Can you run the runner with the -X -e flags and send me the log please? (Either here or via email from my profile page) - looks like whatever .7z file you tried to upload there didn't work for some reason. On the face of it what you're doing should just work, so hopefully the log'll give some indication! |
@bootrider I experienced a similar issue. |
I upgrade SonarQube to LTS version as well as the runner and the information of coverage appear |
I also experienced this issue with an Angular CLI app. I looked at the LCOV file produced by the karma tests and following the advice of @rodikal started playing around with the format of the SF value. It seems that (for the angular cli apps) the SF value gets suffixed with the following:
When I remove this suffix from the SF values then run sonar-scanner, the code coverage gets reported by SonarQube correctly. |
Interesting - will see if the official JS SonarQube plugin has a way of dealing with this. Any chance you could fire me a copy of an unaltered LCOV file please? I'd like to make LCOV parsing more robust (at the minute it's essentially a copy of the JS plugin one but altered to have fewer deps), so a few examples of things that go horrifically wrong are always helpful! |
Do you have news about this issue?? |
No one has sent me a reproduction case yet, still waiting for an LCOV that causes it |
I have followed this example to generate the Lcov file for my Ionic2 project. it uses karma-remap-istanbul --> https://github.com/lathonez/clicker/blob/master/karma.conf.js And here you are my sonar-project.properties sonar.projectKey=Now:ionic2 TN: |
Any update? |
None yet, though thanks for the example file as it makes it a lot more obvious. I can't find any documented extension to the LCOV format that allows that exclamation-mark delimited affair, and naively just splitting the string and taking everything after any ! in the SF line as the file path doesn't fly as there's no reason you can't have an exclamation mark in a filename or path naturally, without using Angular. Unsure whether to have an extra configuration property that lets you specify the prefix to strip from the SF entries, which would mean it wouldn't work out of the box for Angular (but is an improvement over the current situation), or otherwise try to dynamically detect the template loader path and strip it out. |
Right, I've not got an Angular project to hand to test this on but I've started writing up some test cases for the LCOV parser - the below v0.98 candidate in theory tries to resolve !-containing URLs if they're not part of the analysis set, want to try it out and let me know how you get on? If it does the trick for you I can merge to master. |
Sorry for the delay in responding (been caught up on other things). I will have a look at this in a couple of hours and get back to you. Do you still want me to send you the unaltered lcov file? |
@Pablissimo I just tried the 0.98 snapshot you posted and I get the code coverage reported correctly now. Prior to this I was stripping the suffix from the SF value in order to get the coverage report to appear in sonarqube. I no longer have to do this. Thanks, this seems to have fixed the problem I was having where the coverage report was not appearing in sonarqube for my angular cli code. |
Brill, thanks for the feedback, will merge it tonight and tee up a release (though it'll be the same binary). |
Released in v0.98 (same binary as above but now a 'proper' release) |
hello fellow,
I installed the plugin in my SonarQube instance and configure the path to the LCOV file, I generate transpile the code from TS to JS, the I use Karma to generate a LCOV file, it points to JS sources, so after that I use remap-Istanbul to create other file that point the coverage to the TS files.
I placed both files to be used for the plugin regarding the coverage of the tests but I always get 0% coverage.
is there an configuration that I am missing?
Uploading coverage.7z…
The text was updated successfully, but these errors were encountered: