web icon indicating copy to clipboard operation
web copied to clipboard

Sonar and Junit support for Angular with multiple modules

Open dsteindo opened this issue 6 months ago • 0 comments

Hello, I know this project is still not production ready.

But I would like to highlight something we currently use with Karma that needs to be considered when moving to web test runner in the furture.

How I got interested in this runner: https://danywalls.com/testing-in-angular-replace-karma-to-web-test-runner

karma-junit-reporter

https://www.npmjs.com/package/karma-junit-reporter

I think this will be replaced with https://modern-web.dev/docs/test-runner/reporters/junit/ so it might already be considered

karma-sonarqube-reporter

https://www.npmjs.com/package/karma-sonarqube-reporter

As of now I have not found anything that we can use as a replacement.

Examples

It would be awesome to have an example somewhere (for example a github repository) with an Angular project running with web test runner and Sonar and Junit support integrated.

Multiple modules/projects

See https://angular.dev/reference/configs/file-structure#multiple-projects

It would be amazing to be able to consider multiple modules/projects in the same repo and consider it for reports, lets imagine the Angular app to have following structure when everything works:

  • projects
    • my-app
    • my-lib1
    • my-lib2
  • reports
    • junit
      • report_my-app.xml
      • report_my-lib1.xml
      • report_my-lib2.xml
    • sonar
      • executions_my-app.xml
      • executions_my-lib1.xml
      • executions_my-lib2.xml
  • angular.json
  • package-lock.json
  • package.json
  • ...

Note:

  • project my_app can be seen as the app container, which loads content of the respective modules when needed
  • project my-lib1 and my-lib2 are isolated from each other (separation of concerns)
  • with karma each project had it's own karma.conf.js file, the global angular.json described the runner and location of karma.conf.js file for each project

dsteindo avatar Aug 22 '24 09:08 dsteindo