Sonarqube 测试报告“报告指的是一个未配置为测试文件的文件”当测试和源在一起时

Jar*_*eth 8 typescript sonarqube jestjs

我正在使用 TypeScript 和 Jest,并且在我的源文件旁边有我的测试。例如:

  • 某个目录
    • someCode.ts
    • someCode.spec.ts

当我尝试导入 text-report.xml(看起来不错并且与格式匹配)时,我收到一条错误消息:

'第 X 行报告引用了一个未配置为测试文件的文件:/someDir/someCode.spec.ts'

我需要在 Sonarqube 属性中进行什么配置,以便它了解哪些文件是测试文件,哪些是源文件?

Jar*_*eth 9

似乎它没有使用“.”检测子文件夹中的文件。我能够让它工作的唯一方法是列出所有文件夹。

sonar.sources=helpers,managers,routes,schemas,types
sonar.tests=helpers,managers,routes,schemas,types
sonar.exclusions=**/*.js,test-data,dist,coverage
sonar.test.inclusions=**/*.spec.ts
sonar.testExecutionReportPaths=test-report.xml
sonar.typescript.lcov.reportPaths=coverage/lcov.info
Run Code Online (Sandbox Code Playgroud)