web
web copied to clipboard
Sonar and Junit support for Angular with multiple modules
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
- junit
- 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
andmy-lib2
are isolated from each other (separation of concerns) - with karma each project had it's own
karma.conf.js
file, the globalangular.json
described the runner and location ofkarma.conf.js
file for each project