Sonarqube测试报告“报告是指未配置为测试文件的文件".当测试和来源在一起时 [英] Sonarqube test report "report refers to a file which is not configured as a test file" when tests and source are together
问题描述
我正在使用TypeScript和Jest,并将测试放在源文件旁边.例如:
I am using TypeScript and Jest and have my tests next to my source files. e.g:
- someDir
- someCode.ts
- someCode.spec.ts
- someDir
- someCode.ts
- someCode.spec.ts
当我尝试导入text-report.xml(看起来很好并且与格式匹配)时,出现错误消息:
When I try and import the text-report.xml (which looks to be fine and matches the format), I get an error saying:
第X行报告引用的文件未配置为测试文件:/someDir/someCode.spec.ts"
'Line X report refers to a file which is not configured as a test file: /someDir/someCode.spec.ts'
我需要在Sonarqube属性中进行什么配置,以便它了解哪些文件是测试文件,哪些是源文件?
What configuration do I need in in the Sonarqube properties so that it understand which files are tests and which are source?
推荐答案
似乎无法使用."检测子文件夹中的文件.我能够使其正常工作的唯一方法是列出所有文件夹.
Seems it doesn't detect files in sub-folders using ".". Only way I was able to get it working was to list all of the folders.
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
这篇关于Sonarqube测试报告“报告是指未配置为测试文件的文件".当测试和来源在一起时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!