SonarQube玩笑并做出反应-覆盖0条新覆盖的行

问题描述 投票:0回答:1

我将Jest与SonarQube集成在一起,SonarQube执行失败并抛出以下错误,

分析通用测试执行报告'** / reports / test-reporter.xml'时出错。查看SonarQube文档以了解所需的XML格式。

并且在SonarQube仪表板中获得“要覆盖的0条新行的覆盖范围”

enter image description here

下面是我的声纳和package.json配置

sonar.projectKey=projectname
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.branch.name=branchname

sonar.sources=**/src
sonar.tests=**/src/__test__

sonar.test.inclusions=**/src/__test__/*.spec.js
sonar.coverage.exclusions=**/src/__test__/__snapshots__/**
sonar.exclusions=**/src/assets/*

sonar.javascript.lcov.reportPaths=**/output/coverage/jest/lcov.info
sonar.testExecutionReportPaths=**/reports/test-reporter.xml



 "jest": {
    "verbose" :true,
    "notify": true,
    "testRegex": "((\\.|/*.)(spec))\\.js?$",
    "moduleNameMapper": {
      "^.+\\.(css|less|scss|sass)$": "identity-obj-proxy"
    },
    "moduleDirectories": ["node_modules", "src"],
    "transformIgnorePatterns": [
      "node_modules/(?!@agm)"
    ],
    "testResultsProcessor": "jest-sonar-reporter",
    "automock": false,
    "collectCoverage":true,
    "coverageReporters": [
      "text",
      "lcov"
    ],
    "reporters": [
      "default"
    ]
  },

  "jestSonar": {
    "sonar56x": true,
    "reportPath": "reports",
    "reportFile": "test-reporter.xml",
    "indent": 4

  },

请对此提出建议。 TIA。

reactjs unit-testing jestjs sonarqube sonarqube-scan
1个回答
0
投票

请注意,分支或pr分析中的声纳法仅显示差异。因此,当您在其中没有代码更改时,它不会向您显示覆盖率信息。 Code and details of code coverage not showing in SonarCloud for .Net solution很好地解释了这一点。

© www.soinside.com 2019 - 2024. All rights reserved.