Sonarqube 测试报告 "report refers to a file which is not configured as a test file" 当测试和源在一起时
Sonarqube test report "report refers to a file which is not configured as a test file" when tests and source are together
我正在使用 TypeScript 和 Jest,并且在我的源文件旁边有我的测试。例如:
- 一些目录
- someCode.ts
- someCode.spec.ts
当我尝试导入 text-report.xml(看起来不错并且符合格式)时,我收到一条错误消息:
'Line X report refers to a file which is not configured as a test file: /someDir/someCode.spec.ts'
我需要在 Sonarqube 属性中进行哪些配置,以便它了解哪些文件是测试文件,哪些文件是源文件?
它似乎没有检测到使用“.”的子文件夹中的文件。我能够让它工作的唯一方法是列出所有文件夹。
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
你可以试试
sonar.sources = **/someDir/**/*
sonar.tests = **/someDir/*
//or
sonar.sources = **/someDir/*
sonar.tests = **/someDir/*
取决于您是否有任何子目录。可能是列出测试和来源的所有位置的更好选择。
对我来说,即使在添加 sonar.test.inclusions=**/*-spec.js
之后,测试报告也没有出现。添加 sonar.tests=.(same as sonar.sources)
后有效
我正在使用 TypeScript 和 Jest,并且在我的源文件旁边有我的测试。例如:
- 一些目录
- someCode.ts
- someCode.spec.ts
当我尝试导入 text-report.xml(看起来不错并且符合格式)时,我收到一条错误消息:
'Line X report refers to a file which is not configured as a test file: /someDir/someCode.spec.ts'
我需要在 Sonarqube 属性中进行哪些配置,以便它了解哪些文件是测试文件,哪些文件是源文件?
它似乎没有检测到使用“.”的子文件夹中的文件。我能够让它工作的唯一方法是列出所有文件夹。
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
你可以试试
sonar.sources = **/someDir/**/*
sonar.tests = **/someDir/*
//or
sonar.sources = **/someDir/*
sonar.tests = **/someDir/*
取决于您是否有任何子目录。可能是列出测试和来源的所有位置的更好选择。
对我来说,即使在添加 sonar.test.inclusions=**/*-spec.js
之后,测试报告也没有出现。添加 sonar.tests=.(same as sonar.sources)