Sonarqube ignore tests file

Asked by At

I'm using Sonarqube to check my code (Typescript), and I want to feed the coverage section of my project, but during analisys step, Sonarqube it's always ignoring my tests file.

LOG OUTOUT

[14:19:40][Step 2/7] 15:19:40.702 INFO  - Sensor SonarTS [typescript] (done) | time=18007ms
[14:19:40][Step 2/7] 15:19:40.702 INFO  - Sensor Generic Test Executions Report
[14:19:40][Step 2/7] 15:19:40.703 INFO  - Parsing /opt/BuildAgent/work/75c8514d66f0312a/coverage/sonar.xml
[14:19:40][Step 2/7] 15:19:40.720 INFO  - Imported test execution data for 0 files
[14:19:40][Step 2/7] 15:19:40.720 INFO  - Test execution data ignored for 19 unknown files, including:
[14:19:40][Step 2/7] tests/modules/account/datamodel.spec.ts
[14:19:40][Step 2/7] tests/modules/account/graphql.spec.ts
[14:19:40][Step 2/7] tests/modules/cron/datamodel.spec.ts
[14:19:40][Step 2/7] tests/modules/cron/graphql.spec.ts
[14:19:40][Step 2/7] tests/modules/dynamic-field/datamodel.spec.ts
[14:19:40][Step 2/7] 15:19:40.720 INFO  - Sensor Generic Test Executions Report (done) | time=18ms
[14:19:40][Step 2/7] 15:19:40.722 INFO  - ------------- Run sensors on project
[14:19:40][Step 2/7] 15:19:40.728 INFO  - Sensor Zero Coverage Sensor
[14:19:40][Step 2/7] 15:19:40.773 INFO  - Sensor Zero Coverage Sensor (done) | time=45ms

I already check, and all those "unknow files" exists. What am I doing wrong?

1 Answers

0
Community On

SOLUTION.

On my TeamCity additional parameters I put:

-Dsonar.testExecutionReportPaths=coverage/sonar.xml
-Dsonar.test.inclusions=tests/modules/**/*.spec.ts
-Dsonar.tests=.