Я использую jest-sonar-reporter для освещения, как показано ниже:
package.json
{
"name": "app",
"version": "1.0.0",
"description": "The task runner packages for Gulp",
"main": "gulpfile.js",
"scripts": {
...
"test": "jest --coverage",
...
},
"devDependencies": {
...
"jest": "26.0.1",
"jest-sonar-reporter": "2.0.0",
...
},
"jest": {
...
"collectCoverage": true,
"testResultsProcessor": "jest-sonar-reporter"
},
"jest-junit": {
"suiteName": "jest tests",
...
}
}
У меня есть файл test-report.xml, сгенерированный после теста запуска npm, как показано ниже:
тестовый отчет.xml
<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
<file path="<path to>\AreaList.test.jsx">
<testCase name="Description 1 " duration="6"/>
</file>
<file path="<path to>\selectors.search.test.js">
<testCase name="Description 2 " duration="2"/>
</file>
</testExecutions>
Команда сонарсканера:
sonar-scanner.bat -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Project-A -Dsonar.projectName=Project-A -Dsonar.sourceEncoding=UTF-8 -Dsonar.testExecutionReportPaths=\test -отчет.xml
Я получаю ошибку как:
INFO: Parsing <path to>\test-report.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 5:29.011s
INFO: Final Memory: 15M/68M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of generic test execution report '<path to>\test-report.xml'. Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: Line 3 of report refers to a file which is not configured as a test file: <path to>\AreaList.test.jsx
Я пропустил какую-либо конфигурацию?
Ценю ваш ответ. Спасибо.