【问题标题】:Mocha SonarQube does not recognize Node.JS codeMocha SonarQube 无法识别 Node.JS 代码
【发布时间】:2020-10-13 05:38:20
【问题描述】:

我正在使用 Mocha 和 SonarQube 来测试我的 Node.JS 应用程序。它在詹金斯上运行。 这是我在 package.json 中的依赖:

"mocha-sonarqube-reporter": "^1.0.1",
"sonarqube-scanner": "^2.6.0"

这是我的脚本:

const scanner = require("sonarqube-scanner");
scanner(
  {
    serverUrl: "http://sonarqube.dp-common-quality.svc.cluster.local:9000",
    token: "60c98634b2c56a9948d0bfbb4e2d1286779368a4",
    options: {
      "sonar.projectVersion": "1.0.0",
      "sonar.sourceEncoding": "UTF-8",
      "sonar.log.level": "TRACE",
      "sonar.verbose": "true",
      "sonar.scm.disabled": "true",
      "sonar.sources": "BusinessLogic, routes, bin, app.js",
      "sonar.tests": "tests",
      "sonar.test.inclusions": "tests/apitests.js",
      "sonar.javascript.jstest.reportsPath": "test_reports",
      "sonar.javascript.lcov.reportPath": "coverage/lcov.info",
      "sonar.testExecutionReportPaths": "test_reports/sonarqube/test_results.xml"
    }
  },
  () => process.exit()
);

test_reports/sonarqube/test_results.xml 已生成,但是当 sonarqube 扫描仪运行时,它会报告以下错误: 06:58:49.445 ERROR: Caused by: Line 2 of report refers to a file with an unknown language: tests/apitests.js 任何建议和见解表示赞赏

【问题讨论】:

  • 我也有同样的问题,你解决了吗?

标签: javascript node.js sonarqube mocha.js sonarqube-scan


【解决方案1】:

解决方案:我没有在 SonarQube 服务器中为我的 Node.JS 设置新项目。

【讨论】:

    猜你喜欢
    • 2016-05-20
    • 2018-08-29
    • 1970-01-01
    • 1970-01-01
    • 2018-03-08
    • 2014-01-16
    • 2017-11-19
    • 1970-01-01
    相关资源
    最近更新 更多