From d57c6d203d965d552a41b204e457a0b8494943c1 Mon Sep 17 00:00:00 2001 From: Sudip Bhattarai Date: Thu, 2 May 2024 16:41:24 +0545 Subject: [PATCH] Configure sonar-scanner --- .github/workflows/frontend_sonar_scan.yml | 2 +- .gitignore | 3 +++ govtool/frontend/sonar-project.properties | 8 +++++++- govtool/frontend/vite.config.ts | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/frontend_sonar_scan.yml b/.github/workflows/frontend_sonar_scan.yml index 8a4df29ab..9827056d6 100644 --- a/.github/workflows/frontend_sonar_scan.yml +++ b/.github/workflows/frontend_sonar_scan.yml @@ -20,7 +20,7 @@ jobs: projectBaseDir: govtool/frontend env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_HOST_URL: https://sonarcloud.io # Fail the build if it doesn't meet quality gate # - uses: sonarsource/sonarqube-quality-gate-action@master diff --git a/.gitignore b/.gitignore index 2bad55163..c242ad8d8 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,6 @@ scripts/govtool/dev-postgres_password # nodejs/yarn node_modules + +# sonar scanner +.scannerwork/ \ No newline at end of file diff --git a/govtool/frontend/sonar-project.properties b/govtool/frontend/sonar-project.properties index e31d782bf..b7334acaf 100644 --- a/govtool/frontend/sonar-project.properties +++ b/govtool/frontend/sonar-project.properties @@ -1 +1,7 @@ -sonar.projectKey=voltaire-era_AYra4oOPzihwqYo-BApS +sonar.projectKey=intersect-govtool +sonar.sources=./src +sonar.host.url=https://sonarcloud.io +sonar.organization=intersect +sonar.javascript.lcov.reportPaths=./coverage/lcov.info +sonar.junit.reportsPath=./junit-report.xml +sonar.exclusions=node_modules \ No newline at end of file diff --git a/govtool/frontend/vite.config.ts b/govtool/frontend/vite.config.ts index 4316c151e..0442b81a1 100644 --- a/govtool/frontend/vite.config.ts +++ b/govtool/frontend/vite.config.ts @@ -51,7 +51,11 @@ const vitestConfig = defineVitestConfig({ setupFiles: "./src/setupTests.ts", globals: true, environment: "jsdom", - reporters: ["verbose", "junit"], + reporters: ["default","junit"], + outputFile: { + junit: './junit-report.xml', + json: './json-report.json', + }, coverage: { include: [ "src/components/**/*", @@ -62,7 +66,8 @@ const vitestConfig = defineVitestConfig({ "src/utils/**/*", ], provider: "v8", - reporter: ["json-summary"], + reporter: ["json-summary","lcov"], + reportOnFailure: true, enabled: true, }, },