From b54ae9696a479cdd8e2a264ed119d2edac71955d Mon Sep 17 00:00:00 2001 From: klu909 <55161078+klu909@users.noreply.github.com> Date: Thu, 3 Dec 2020 15:37:24 -0800 Subject: [PATCH] fix(2288): fix sonarqube setting (#30) --- mocha.config.json | 6 ++++++ package.json | 7 +++++-- screwdriver.yaml | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 mocha.config.json diff --git a/mocha.config.json b/mocha.config.json new file mode 100644 index 0000000..1857191 --- /dev/null +++ b/mocha.config.json @@ -0,0 +1,6 @@ +{ + "reporterEnabled": "spec, mocha-sonarqube-reporter", + "mochaSonarqubeReporterReporterOptions": { + "output": "./artifacts/report/test.xml" + } +} \ No newline at end of file diff --git a/package.json b/package.json index 59a4833..ef600b3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "pretest": "eslint .", - "test": "jenkins-mocha --recursive", + "test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 4000 --retries 1 --exit --allow-uncaught true --color true", "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, "bin": { @@ -45,7 +45,10 @@ "chai": "^4.2.0", "eslint": "^4.19.0", "eslint-config-screwdriver": "^3.0.1", - "jenkins-mocha": "^6.0.0", + "mocha": "^8.2.1", + "mocha-multi-reporters": "^1.5.1", + "mocha-sonarqube-reporter": "^1.0.2", + "nyc": "^15.0.0", "mockery": "^2.0.0", "sinon": "^7.1.0" }, diff --git a/screwdriver.yaml b/screwdriver.yaml index c3787c4..b7a038c 100644 --- a/screwdriver.yaml +++ b/screwdriver.yaml @@ -1,10 +1,10 @@ shared: - image: node:6 + image: node:12 jobs: main: environment: - SD_SONAR_OPTS: "-Dsonar.sources=index.js -Dsonar.javascript.lcov.reportPath=artifacts/coverage/lcov.info" + SD_SONAR_OPTS: "-Dsonar.sources=index.js -Dsonar.tests=test -Dsonar.javascript.lcov.reportPaths=artifacts/coverage/lcov.info -Dsonar.testExecutionReportPaths=artifacts/report/test.xml" requires: [~pr, ~commit] steps: - install: npm install