From 4a4d45fadfbb61e8e147f2b62e5dab5ac55403e8 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 6 Mar 2020 14:42:45 +0000 Subject: Enabling JS in SonarCloud Configures jest test coverage and missing sonar properties for javascript file scan and report. Change-Id: I9170a176cc4e580ac14f669c334ee949942503f6 Issue-ID: SDC-2741 Signed-off-by: andre.schmid --- catalog-ui/package.json | 14 +++++++++----- catalog-ui/pom.xml | 20 ++++++++++++++++++-- .../palette/services/palette.service.spec.ts | 2 +- catalog-ui/src/tsconfig.json | 6 ------ 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'catalog-ui') diff --git a/catalog-ui/package.json b/catalog-ui/package.json index 1625802dce..fc99b356dc 100644 --- a/catalog-ui/package.json +++ b/catalog-ui/package.json @@ -12,11 +12,11 @@ "designer": "npm start -- --env.role designer", "admin": "npm start -- --env.role admin", "start": "webpack-dev-server", - "build": "npm run test && webpack --config webpack.config.js", - "build:prod": "npm run test && webpack --config webpack.production.js", + "build": "webpack --config webpack.config.js", + "build:prod": "webpack --config webpack.production.js", "lint": "ng lint", "pree2e": "webdriver-manager update --standalone false --gecko false --quiet", - "test": "jest", + "test": "jest --coverage", "test:watch": "jest --watch", "cypress": "cypress run", "cypress-headless": "start-server-and-test start http-get://localhost:9000 cypress" @@ -24,11 +24,15 @@ "jest": { "preset": "jest-preset-angular", "collectCoverageFrom": [ - "src/app/ng2/pages/composition/**/*.ts" + "/src/app/ng2/**/*.ts" + ], + "coverageDirectory": "/target/code-coverage/", + "coverageReporters": [ + "lcov" ], "setupTestFrameworkScriptFile": "/src/jest/setup-jest.ts", "transformIgnorePatterns": [ - "node_modules/(?!onap-ui-angular)" + "/node_modules/(?!onap-ui-angular)" ], "verbose": true, "roots": [ diff --git a/catalog-ui/pom.xml b/catalog-ui/pom.xml index f08fb64276..f8d4e3f70c 100644 --- a/catalog-ui/pom.xml +++ b/catalog-ui/pom.xml @@ -13,6 +13,11 @@ 1.7.0-SNAPSHOT + + ${project.basedir}/node/node + src/app/ng2 + + @@ -26,7 +31,6 @@ clean - ${project.parent.basedir}/catalog-fe/src/main/webapp @@ -72,7 +76,7 @@ com.github.eirslett frontend-maven-plugin - ${project.parent.basedir} + ${project.basedir} @@ -118,6 +122,18 @@ run build:prod + + + npm_test + + npm + + test + + test + ${skipTests} + + diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.spec.ts b/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.spec.ts index 3a660c1de7..7234c120e8 100644 --- a/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.spec.ts +++ b/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.spec.ts @@ -23,7 +23,7 @@ describe('palette component', () => { providers: [CompositionPaletteService, {provide: HttpClient, useValue: httpServiceMock}, {provide: SdcConfigToken, useValue: sdcConfigToken}, - {provide: WorkspaceService, useValue{}} + {provide: WorkspaceService, useValue: {}} ] }); diff --git a/catalog-ui/src/tsconfig.json b/catalog-ui/src/tsconfig.json index 81d527b763..af1d58ce1a 100644 --- a/catalog-ui/src/tsconfig.json +++ b/catalog-ui/src/tsconfig.json @@ -5,7 +5,6 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowJs": true, - "mapRoot": "./", "module": "commonjs", "moduleResolution": "node", "outDir": "../dist/out-tsc", @@ -13,11 +12,6 @@ "es6", "dom" ], - "paths": { - "@angular/*": [ - "../node_modules/@angular/*" - ] - }, "sourceMap": true, "target": "es5", "typeRoots": [ -- cgit 1.2.3-korg