Sonarqube忽略测试文件

时间:2019-05-13 14:30:50

标签: sonarqube test-coverage

我正在使用Sonarqube来检查我的代码(Typescript),我想提供项目的coverage部分,但是在analisys步骤中,Sonarqube总是忽略我的测试文件。

注销

[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

我已经检查过,并且所有那些“未知文件”都存在。我在做什么错了?

1 个答案:

答案 0 :(得分:0)

解决方案。

我在TeamCity上添加了其他参数:

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