Hi,
I’m trying to add SonarQube analysis to an Azure Devops pipeline on an Angular project.
Which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension):
- SonarQube Developer Edition Version 8.1 (build 31237)
- SonarQube Scanner 4.2.0.1873
What are you trying to achieve
I’m trying to analyze an Angular project from an Azure DevOps pipeline and publish the report to a SonarQube server.
What have you tried so far to achieve this
So far, the general analysis has worked (bugs, code smells, Quality Gate, etc.), however it seems unable to measure the code coverage.
This are the settings on the ‘Prepare Analysis Configuration’ step:
sonar.sources=src
sonar.exclusions=src/**/*.spec.ts,src/testing/**/*,src/assets/**/*
sonar.test=src
soanr.test.inclusions=src/**/*.spec.ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=coverage/sonar-test-reporter.xml
And this are what I assume to be the relevant parts of the Code Analysis log:
[...]
INFO: Found 1 tsconfig.json file(s): [C:\CI\4\_work\1140\s\tsconfig.json]
INFO: 370 source files to be analyzed
INFO: Analyzing 370 files using tsconfig: C:\CI\4\_work\1140\s\tsconfig.json
INFO: 0/370 files analyzed, current file: src/app/common/enums/window-type.ts
INFO: 0/370 files analyzed, current file: src/app/common/enums/window-type.ts
INFO: 153/370 files analyzed, current file: src/app/services/favorites/favorites.service.ts
INFO: 370/370 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=73072ms
INFO: Sensor Generic Test Executions Report
INFO: Parsing C:\CI\4\_work\1140\s\coverage\sonar-test-reporter.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 164 unknown files, including:
src/app/components/fragment-definition/create-edit-fragment/create-edit-fragment.component.spec.ts
src/app/components/navigation-bar/import-button/import-button.component.spec.ts
src/app/components/document-config/document-config.component.spec.ts
src/app/components/merge/merge.component.spec.ts
src/app/components/structure/structure.component.spec.ts
INFO: Sensor Generic Test Executions Report (done) | time=63ms
[...]
It looks that it’s unable to match the path in the report file to the actual file.
I’m also processing the report file changing the paths from abosulte to relative (e.g.: C:\CI\[...]\src\[...]
to src/[...]
) because the absolute ones didn’t work either.
I’ve also tried removing the sonar.exclusions
setting, but the result has been the same.
What am I missing?
Thanks!