javascript - SonarQube unit test report doesnt show Javascript files
问题描述
I have a maven project with modules in both Java and Javascript. I am not seeing the Javascript unit test files in test report in SonarQube but only Java unit test files. coverage_reports
In coverage_reports
folder I have cobertura-coverage.xml
created by Jest.
Is this sonar.javascript.jstest.reportPaths
still used or has it been replaced by some other configuration. We are using Sonarqube 6.7 at our server.
Edit:
For others to know, I used jest-sonar-reporter
and test script as
"test": "cross-env CI=true NODE_PATH=./src react-scripts test --env=jsdom --coverage --no-cache -u --testResultsProcessor jest-sonar-reporter"
This created a test report xml file that I used like this
<sonar.tests>src/test</sonar.tests>
<sonar.testExecutionReportPaths>path/to/test-report.xml</sonar.testExecutionReportPaths>
<sonar.javascript.lcov.reportPaths>path/to/lcov.info</sonar.javascript.lcov.reportPaths>
解决方案
As far as I can say sonar.javascript.jstest.reportPaths
doesn't exist (and never did).
There are 2 things (from question I'm not sure which one you need):
- Unit test report import (how many unit tests, which failed, which skipped etc). For that, see doc here (you will need to use
sonar.testExecutionReportPaths
property eventually). - Coverage report import. If you are able to produce LCOV see doc here. If not, you will need to convert your report in generic SonarQube format (see here).
Finally, to see unit test files for JS, set correctly sonar.tests
property (Java test files are displayed due to smart enough maven scanner)
推荐阅读
- java - Firebase 事务返回 ArrayList 处理
- css - 使用@page 隐藏第一页的内容
- amazon-web-services - AWS Textract 如何测量页数?
- javascript - 在反应中上传图像不返回表单数据值
- dialogflow-es - Dialogflow 实体 - 区分大小写
- python - Python - 订购字典/嵌套字典的元组
- azure - Azure - 从 Outlook 下载附件而不使用 logicapp 并将其移动到 Blob 存储
- docker - 下载后 Docker 不会启动新的基于 Ubuntu 的容器
- c# - 如何同时进行数据排序和过滤?
- c# - 替换文本框中的特定文本 C#