Sonarqube test report “report refers to a file which is not configured as a test file” when tests and source are together

前端 未结 3 1880
情话喂你
情话喂你 2021-01-18 06:33

I am using TypeScript and Jest and have my tests next to my source files. e.g:

  • someDir
    • someCode.ts
    • someCode.spec.ts
<
相关标签:
3条回答
  • 2021-01-18 06:40

    You can try

    sonar.sources = **/someDir/**/*
    sonar.tests = **/someDir/*
    //or
    sonar.sources = **/someDir/*
    sonar.tests = **/someDir/*
    

    Depending on if you have any sub-directories. Might be a better alternative to listing all locations for both tests and sources.

    0 讨论(0)
  • 2021-01-18 06:44

    For me even after adding sonar.test.inclusions=**/*-spec.js , test reports were not coming. It worked after adding sonar.tests=.(same as sonar.sources)

    0 讨论(0)
  • 2021-01-18 06:52

    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
    
    0 讨论(0)
提交回复
热议问题