From bf482d9a28fe5d1cddfa7cd71c9b5c5e411309dd Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Sat, 14 Sep 2024 10:52:08 +0200 Subject: [PATCH] Update vue-core vitest configuration and sonar properties for front --- .../client/vue/vitest.config.ts.mustache | 16 +++++++++++++++- .../sonar-fullstack-project.properties.mustache | 9 ++++++++- .../sonar/sonar-project.properties.mustache | 7 ++++++- .../domain/SonarQubeModulesFactoryTest.java | 16 ++++------------ 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/main/resources/generator/client/vue/vitest.config.ts.mustache b/src/main/resources/generator/client/vue/vitest.config.ts.mustache index 6062abddd0c..bc8b8d93f54 100644 --- a/src/main/resources/generator/client/vue/vitest.config.ts.mustache +++ b/src/main/resources/generator/client/vue/vitest.config.ts.mustache @@ -27,11 +27,25 @@ export default defineConfig({ exclude: [ ...configDefaults.coverage.exclude as string[], 'src/main/webapp/app/main.ts', + 'src/main/webapp/app/injections.ts', + 'src/main/webapp/app/router.ts', + 'src/main/webapp/app/home/application/HomeRouter.ts', 'src/main/webapp/**/*.component.ts', ], provider: 'istanbul', reportsDirectory: '{{projectBuildDirectory}}/test-results/', - reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'] + reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], + thresholds: { + perFile: true, + autoUpdate: true, + 100: true, + }, + watermarks: { + statements: [100, 100], + branches: [100, 100], + functions: [100, 100], + lines: [100, 100], + }, }, }, }); diff --git a/src/main/resources/generator/server/sonar/sonar-fullstack-project.properties.mustache b/src/main/resources/generator/server/sonar/sonar-fullstack-project.properties.mustache index 19fefbb56a7..6774d49da0c 100644 --- a/src/main/resources/generator/server/sonar/sonar-fullstack-project.properties.mustache +++ b/src/main/resources/generator/server/sonar/sonar-fullstack-project.properties.mustache @@ -17,7 +17,14 @@ sonar.testExecutionReportPaths={{projectBuildDirectory}}/test-results/TESTS-resu sonar.javascript.lcov.reportPaths={{projectBuildDirectory}}/test-results/lcov.info sonar.sourceEncoding=UTF-8 -sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, {{projectBuildDirectory}}/classes/static/**/*.*, src/main/webapp/app/index.tsx +sonar.exclusions=\ + src/main/webapp/app/home/infrastructure/primary/*.*,\ + src/main/webapp/app/home/application/*.ts,\ + src/main/webapp/app/*.ts,\ + src/main/webapp/content/**/*.*,\ + {{projectBuildDirectory}}/classes/static/**/*.*,\ + src/main/webapp/app/index.tsx,\ + src/main/webapp/main.ts sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6437,S6564,UndocumentedApi diff --git a/src/main/resources/generator/server/sonar/sonar-project.properties.mustache b/src/main/resources/generator/server/sonar/sonar-project.properties.mustache index 2e78d59b9a6..9dcdc64e640 100644 --- a/src/main/resources/generator/server/sonar/sonar-project.properties.mustache +++ b/src/main/resources/generator/server/sonar/sonar-project.properties.mustache @@ -14,7 +14,12 @@ sonar.java.codeCoveragePlugin=jacoco sonar.junit.reportPaths={{projectBuildDirectory}}/surefire-reports,{{projectBuildDirectory}}/failsafe-reports sonar.sourceEncoding=UTF-8 -sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, {{projectBuildDirectory}}/classes/static/**/*.*, src/main/webapp/app/index.tsx +sonar.exclusions=\ + src/main/webapp/app/*.ts,\ + src/main/webapp/content/**/*.*,\ + {{projectBuildDirectory}}/classes/static/**/*.*,\ + src/main/webapp/app/index.tsx,\ + src/main/webapp/main.ts sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6548,S6437,S6471,UndocumentedApi diff --git a/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java index 409bcbba3e9..b7967b2aed9 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java @@ -40,9 +40,7 @@ void shouldBuildBackendModule() { .hasFile("sonar-project.properties") .containing("sonar.coverage.jacoco.xmlReportPaths=target/jacoco/jacoco.xml") .containing("sonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports") - .containing( - "sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, target/classes/static/**/*.*, src/main/webapp/app/index.tsx" - ) + .containing("sonar.exclusions=\\") .notContaining("sonar.testExecutionReportPaths=target/test-results/TESTS-results-sonar.xml"); } @@ -54,9 +52,7 @@ void shouldBuildBackendFrontendModule() { assertCommonModule(module) .hasFile("sonar-project.properties") - .containing( - "sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, target/classes/static/**/*.*, src/main/webapp/app/index.tsx" - ) + .containing("sonar.exclusions=\\") .containing("sonar.testExecutionReportPaths=target/test-results/TESTS-results-sonar.xml") .containing("sonar.javascript.lcov.reportPaths=target/test-results/lcov.info"); } @@ -134,9 +130,7 @@ void shouldBuildBackendModule() { assertCommonModule(module) .hasFile("sonar-project.properties") - .containing( - "sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, build/classes/static/**/*.*, src/main/webapp/app/index.tsx" - ) + .containing("sonar.exclusions=\\") .notContaining("sonar.testExecutionReportPaths=build/test-results/TESTS-results-sonar.xml"); } @@ -148,9 +142,7 @@ void shouldBuildBackendFrontendModule() { assertCommonModule(module) .hasFile("sonar-project.properties") - .containing( - "sonar.exclusions=src/main/webapp/main.ts, src/main/webapp/app/main.ts, src/main/webapp/content/**/*.*, build/classes/static/**/*.*, src/main/webapp/app/index.tsx" - ) + .containing("sonar.exclusions=\\") .containing("sonar.testExecutionReportPaths=build/test-results/TESTS-results-sonar.xml") .containing("sonar.javascript.lcov.reportPaths=build/test-results/lcov.info"); }