I am using Mocha with SonarQube to test my Node.JS application. It runs on Jenkins.
This is my dependency in package.json:
"mocha-sonarqube-reporter": "^1.0.1",
"sonarqube-scanner": "^2.6.0"
This is my script:
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
is generated but when sonarqube scanner runs, it reports the following error:
06:58:49.445 ERROR: Caused by: Line 2 of report refers to a file with an unknown language: tests/apitests.js
Any advice and insight is appreciated