From 3ce3724d46c0c1d4d13613b1920e3da858117e23 Mon Sep 17 00:00:00 2001 From: "saul.gill" <saul.gill@est.tech> Date: Mon, 1 Nov 2021 15:12:48 +0000 Subject: Adding gui-clamp coverage to sonar Added sonar properties to pom.xml Added jest sonar properties to package.json Issue-ID: POLICY-3804 Change-Id: I1b5bc67bc5457661ed56fdfe4d7fd260282f664b Signed-off-by: saul.gill <saul.gill@est.tech> --- gui-clamp/pom.xml | 3 +++ gui-clamp/ui-react/package.json | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'gui-clamp') diff --git a/gui-clamp/pom.xml b/gui-clamp/pom.xml index d9cd62c..01978fb 100644 --- a/gui-clamp/pom.xml +++ b/gui-clamp/pom.xml @@ -33,6 +33,9 @@ <ui.react.src>ui-react</ui.react.src> <ui.react.lib.src>ui-react-lib</ui.react.lib.src> <npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url> + <sonar.nodejs.executable>${project.build.directory}/ui-react/node/node</sonar.nodejs.executable> + <sonar.sources>${project.basedir}/ui-react/src</sonar.sources> + <sonar.exclusions>**/*.test.js</sonar.exclusions> </properties> <build> <plugins> diff --git a/gui-clamp/ui-react/package.json b/gui-clamp/ui-react/package.json index 13d830e..a20c7f4 100644 --- a/gui-clamp/ui-react/package.json +++ b/gui-clamp/ui-react/package.json @@ -54,7 +54,8 @@ "history": "5.0.0", "jest": "26.6.0", "jest-canvas-mock": "2.3.1", - "jest-fetch-mock": "3.0.3" + "jest-fetch-mock": "3.0.3", + "jest-sonar-reporter": "2.0.0" }, "browserslist": [ ">0.2%", @@ -64,10 +65,12 @@ ], "jest": { "verbose": true, - "coverageDirectory": "${project.build.directory}/${ui.react.src}/coverage", + "collectCoverage": true, + "coverageDirectory": "${project.build.directory}/code-coverage", "collectCoverageFrom": [ "**/*.{js,jsx}" ], + "testResultsProcessor": "jest-sonar-reporter", "rootDir": "${project.build.directory}/${ui.react.src}", "coverageReporters": [ "lcov" @@ -83,6 +86,12 @@ "enzyme-to-json/serializer" ] }, + "jestSonar": { + "reportPath": "../../target/reports", + "reportFile": "test-reporter.xml", + "indent": 4, + "sonar56x": true + }, "babel": { "presets": [ "@babel/preset-env", -- cgit 1.2.3-korg