sh33dafi / jest-sonar

A jest reporter that generates sonar reports
MIT License
49 stars 11 forks source link

[Doc request] Show example configuration #25

Closed n0th1ng-else closed 4 years ago

n0th1ng-else commented 4 years ago

It would be great to see the full picture going through the readme.

what I mean is I can see how to set up Jest config. But there is no info about sonar-project.properties

Could you please populate readme with Sonar configuration?

sh33dafi commented 4 years ago

Since this is a plug-in for jest to generate the sonar coverage file, documenting how to setup sonar is out of the scope of this project.

Please consult the sonar docs on how to setup sonar https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

n0th1ng-else commented 4 years ago

I understand your motivation. In the meantime, this plugin was created for a specific purpose - to connect sonar with jest. So I would expect to read some end to end example. It might be simple, but it will help people to understand how things work

Right now I am trying to figure out how to do that. Jest produces lcov.info and sonar-report.xml but sonar still does not show coverage in the dashboard. And here I want to understand is it sonar configuration or the plugin issue. I just don't have enough input so realize that

sh33dafi commented 4 years ago

The problem is that there is a multitude of ways to set up sonar, depending on project setup and which build system is used. As for properties that need to be set you can find a sample here: sonar.ts.lcov.reportpath =>path to lcov files comma separated if multiple sonar.junit.reportPaths =>path to xml generated by junit reporter sonar.testExecutionReportPaths =>path to xml generated by this plugin sonar.tests => path where test can be found sonar.sources => path where sources can be found sonar.cpd.exclusions=*/*.spec.ts sonar.inclusions=**/src/**/*.ts sonar.exclusions=**/*.spec.ts,**/test.ts sonar.test.inclusions=**/*.spec.ts,**/test.ts,**/test-setup.ts sonar.coverage.exclusions=**/*.spec.ts,**/test.ts,**/test-setup.ts All paths need to be relative against your project root and project name etc should also be set I hope this was helpful

n0th1ng-else commented 4 years ago

Thank you @sh33dafi ! My confusion was that the sonar did not show coverage metrics in the PR with updated sonar-project.properties. I decided to merge it and see how it will look like and then it updated metrics, npw everything is okay.

appreciate your time and answers. It did help

github-actions[bot] commented 3 years ago

Locked due to an inactive of 90 days