Angular and Sonar integration issues

I have configured angular project for SonarQube. But it gives exception

ERROR: Error during SonarQube Scanner execution ERROR: Error during parsing of generic test execution report ‘/Users/username/abc-fe/reports/ut_report.xml’. Look at the SonarQube documentation to know the expected XML format. ERROR: Caused by: Line 2 of report refers to a file with an unknown language: src/app/requests/detail/abc/abc.component.spec.ts ERROR:
Following is the part of report.xml

<testExecutions version="1">
  <file path="src/app/requests/detail/abc/abc.component.spec.ts">
    <testCase name="ViewDocumentComponent should create" duration="238"/>
  <file path="src/app/shared/alert/zyx.component.spec.ts">
    <testCase name="AlertPopUpModalComponent should create" duration="13"/>

Following are the properties for

sonar.exclusions=**/node_modules/**, src/assets/styles/**
sonar.typescript.lcov.reportPaths= coverage/,
sonar.testExecutionReportPaths= reports/report.xml

I don’t understand what am I doing wrong. Thanks for help.

  • SonarQube Version 7.1 (build 11001)

Hi @Agulbaw,

SonarQube 7.1 is quite out of date and I suspect you’re running a rather old version of SonarJS/SonarTS. I’m not sure why it’s not recognizing your Typescript test files. In more recent releases, we consolidated these analyzers and made many improvements. I strongly encourage you to upgrade at least to the SonarQube 7.9 LTS release, then also make sure to update to the latest compatible SonarJS/TS release, 6.2.1.

Once you’ve done so, you can compare your project setup with an example Angular project I have created in one of our repos and report back if you’re still running into problems.