gpt4 book ai didi

typescript - Sonarqube 测试报告 "report refers to a file which is not configured as a test file"当测试和源在一起时

转载 作者:行者123 更新时间:2023-12-03 17:55:33 26 4
gpt4 key购买 nike

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

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

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

    '第 X 行报告引用了一个未配置为测试文件的文件:/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

    关于typescript - Sonarqube 测试报告 "report refers to a file which is not configured as a test file"当测试和源在一起时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57466369/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com