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 44664cc..b14d8ee 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "pretest": "eslint . --quiet", - "test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --recursive --timeout 4000 --retries 1 --exit --color true", + "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" }, "repository": { @@ -35,7 +35,9 @@ "chai": "^4.2.0", "eslint": "^6.8.0", "eslint-config-screwdriver": "^5.0.3", - "mocha": "^7.0.1", + "mocha": "^8.2.1", + "mocha-multi-reporters": "^1.5.1", + "mocha-sonarqube-reporter": "^1.0.2", "mockery": "^2.0.0", "nyc": "^15.0.0", "sinon": "^4.5.0" diff --git a/screwdriver.yaml b/screwdriver.yaml index 2942a1a..046a496 100644 --- a/screwdriver.yaml +++ b/screwdriver.yaml @@ -4,7 +4,7 @@ shared: 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" steps: - install: npm install - test: npm test