-
Notifications
You must be signed in to change notification settings - Fork 106
Number of Test for TypeScript is not showing in Sonar #44
Comments
It's not something that's currently imported via the plugin, and getting it in there may be quite specific to the runner being used to execute the tests (and what reporting it supports). Happy to take suggestions on formats to accept here. |
We are currently using Junit reporting. Using sonar.javascript.karmajstestdriver.reportsPath for importing the same for JavaScript. But same property does not work for TypeScript. |
Will probably focus on that one first, as Chutzpah will also output JUnit-formatted test summaries and it's a really easy format to handle. |
Thanks and it will be good to have the report imported to sonarqube. Also do you recommend any ts rules other than the ones come with the plugin? |
There is a way I think to do it at the minute with different plugins - they've removed JUnit support from the normal JavaScript plugin, preferring instead to use the 'Generic Coverage Plugin' and requiring that your build process transform the JUnit XML into its standardised format. If you're using Grunt there's a note at the bottom of this page on an NPM package to do the conversion, though you could probably do it with an XSLT as well. Still less pleasant than the plugin doing it for you but may get you out of a hole. |
Sorry - also, no there aren't any extra rules I tend to use although the Microsoft ones are interesting: |
We are generating the Junit XML file and using the sonar.javascript.jstestdriver.reportsPath to import the report. The report is not showing up because the sonar.language=ts ? We are generating the JUnit report for TypeScript language. |
Hi, This seems related to my problem in a way - if not I can open a new issue. Your plugin works great with the code coverage (lcov.info) but no matter what I do I can't seem to have the test-results.xml be recognized by sonarqube. In the scan log I don't see it even try to read the xml. I tried to use the following properties - but with no luck: Is it because it's not supported by your plugin, or I'm doing something wrong? |
The plugin doesn't currently support pulling in test results, only coverage - I need to extend it to pull in details of test runs. I'm not sure whether you can use another plugin to pull that in against files managed by SonarTsPlugin, never tried but doesn't sound good from your testing! |
Hi, It would be nice if you could extend the plugin to support it... With that being said - after a week of experimenting I finally made some breakthrough - the thing I missed was to actually install the "sonar-karma-test-report-plugin" :| Cheers, |
This is really great information. sonar.javascript.karmajstestdriver.reportsPath works fine for Java script and all other languages. When used against the type script it is not importing the XML. The XML file do exist in the test_results folder but still unable to import it. Is it because of the source mappings in the XML file?
|
Hi, I am not sure exactly regarding the reason - the scan log is not meaningful to me at this stage. Snippet from test-result.xml:
A snippet from the scan log:
|
Hi @Pablissimo, Can you mark this as an enhancement request (and perhaps change the title) to enable loading a junit style report? I think the most common report format is the Surefire XML Format - so similar to Java's sonar.junit.reportsPath we would have sonar.ts.reportsPath ? Since the code is TypeScript - if there is no Java/JavaScript file in the project - none of the other plugins are relevant (if there's no Java file in the project, sonar.junit.reportsPath is ignored for instance). This will help me a lot. Thanks, |
Happy to use this issue to track it, unsure when I'll get to it (though pull requests obviously welcomed!). |
Issue I created before I found this one (#82):
So I agree that JUnit format would be the way to go. I think it is more widely supported than the Sonar specific format. |
Cool - another vote is good. I'm currently doing a bit of refactoring to get things in a better shape for this sort of work, so once that's done will start looking at this. |
I suggest you change the title of this Issue to reflect the enhancement request... (and avoiding future duplicate ones). |
Notice: |
Is there any work done on this feature? @Pablissimo |
None yet, nope |
Any news here? We'd also love to have unit test reports (# of tests passed, skipped, duration) in Sonar. |
No sadly not had time to address any of this yet (or indeed a couple of outstanding defects on the plugin). |
Hi, |
This thread just saved me from continuing trying to make this work, I take it as the issue is still open, this still an issue |
I had the same problem and now i'm using karma-sonarqube-unit-reporter, which generate a Generic test file for Sonar. |
@vilchik-elena /karma.config file/ /sonar.project.properties file/
//Project structure project source dir Sonar execution runs successfully and generates report but i dont see the unit test coverage report. Please help. xml
Not sure if am missing something. PLease help |
I am having the exact same issue as @shrutigv with a similar configuration. INFO: Sensor Generic Test Executions Report (Characters ### are just obfuscation of my local path.) My unit-test-report.xml generated by karma-sonarqube-unit-reporter looks like this:
|
@dmberton xml path seems to be wrong.. Point it to right file path. |
I am able to get the coverage information but does not show number of Unit Test vs skipped vs ignored in Sonar. Is there any specific property that we need to specify for this information?
The text was updated successfully, but these errors were encountered: