koliveira15 / nx-sonarqube

A Nx plugin that scans projects using SonarQube / SonarCloud.
MIT License
51 stars 21 forks source link

Not executing tests of nested libraries #24

Closed Jonas-Knebel closed 1 year ago

Jonas-Knebel commented 1 year ago

I am not quite sure if it is a bug or an error on my side, but I will just share my experience.

I have structured my app completly as library components, but grouped app specfic components in a folder with the name of the app like this: libs/appName/home/feature/lib

it includes all relevant sources, but tells me: "Skipping appName as it does not have a test target"

Is that an error on my side, or might that be a problem in the plugin? If you need any more information let me know.

koliveira15 commented 1 year ago

@Jonas-Knebel the plugin expects each dependent project to have a "test" target in its respective project.json configuration to use the coverage directory option. A list of of these coverage directories is then sent through the sonar cli.

Jonas-Knebel commented 1 year ago

@koliveira15 Thanks for the quick reply each project has its own test target and the sources are also found, but not executed for some reason. Also a cool feature, which is missing right now would be disabling the automated sending to sonarqube. In our use case we just need the combined files and then sending is done in an own step in the pipeline.
image

koliveira15 commented 1 year ago

@Jonas-Knebel what does your nx.json's targetDefaults property look like? The plugin doesn't execute the tests as that should be handled by Nx.

Also a cool feature, which is missing right now would be disabling the automated sending to sonarqube. In our use case we just need the combined files and then sending is done in an own step in the pipeline.

The plugin doesn't combine any files as that is not needed for Sonar to do its analysis. It uses the dependency graph to look at which coverage directories to include. If your use case is combine reports, then I would suggest setting up a post script that utilizes istanbul-combine and then send the report in its own pipeline stage.