Sonarqube 测试报告“报告指的是未配置为测试文件的文件".当测试和源在一起时 [英] Sonarqube test report "report refers to a file which is not configured as a test file" when tests and source are together

查看:20
本文介绍了Sonarqube 测试报告“报告指的是未配置为测试文件的文件".当测试和源在一起时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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

    当我尝试导入 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆