diff --git a/src/main/resources/generator/client/react/tsconfig.json b/src/main/resources/generator/client/react/tsconfig.json index e2084baf902..b2acd68c696 100644 --- a/src/main/resources/generator/client/react/tsconfig.json +++ b/src/main/resources/generator/client/react/tsconfig.json @@ -1,28 +1,26 @@ { "compilerOptions": { - "target": "ESNext", + "target": "esnext", "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "react-jsx", "skipLibCheck": true, + "resolveJsonModule": true, "esModuleInterop": false, + "lib": ["esnext", "dom", "dom.iterable"], + "types": ["vitest/globals"], + "baseUrl": ".", "allowSyntheticDefaultImports": true, - "strict": true, "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx", "composite": false, - "module": "esnext", - "moduleResolution": "node", - "baseUrl": "src", - "types": ["vitest/globals"], "paths": { - "@/*": ["main/webapp/app/*"], - "@assets/*": ["main/webapp/assets/*"] + "@/*": ["src/main/webapp/app/*"], + "@assets/*": ["src/main/webapp/assets/*"] } }, - "include": ["vite.config.ts", "src"], - "exclude": ["src/test/javascript/integration/**/*spec.ts", "node_modules"] + "include": ["src/main/**/*", "src/test/javascript/spec/**/*"] } diff --git a/src/main/resources/generator/client/react/vitest.config.ts.mustache b/src/main/resources/generator/client/react/vitest.config.ts.mustache index 0b008487c5e..b5f81abbbf0 100644 --- a/src/main/resources/generator/client/react/vitest.config.ts.mustache +++ b/src/main/resources/generator/client/react/vitest.config.ts.mustache @@ -1,47 +1,49 @@ /// -import { defineConfig } from 'vite'; -import tsconfigPaths from 'vite-tsconfig-paths'; -import react from '@vitejs/plugin-react'; +import { mergeConfig, defineConfig, configDefaults } from 'vitest/config' +import viteConfig from './vite.config' -export default defineConfig({ - plugins: [react(), tsconfigPaths()], - test: { - reporters: ['verbose', 'vitest-sonar-reporter'], - outputFile: { - 'vitest-sonar-reporter': '{{projectBuildDirectory}}/test-results/TESTS-results-sonar.xml', - }, - globals: true, - logHeapUsage: true, - poolOptions: { - threads: { - minThreads: 1, - maxThreads: 2, +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + root: '.', + reporters: ['verbose', 'vitest-sonar-reporter'], + outputFile: { + 'vitest-sonar-reporter': '{{projectBuildDirectory}}/test-results/TESTS-results-sonar.xml', }, - }, - environment: 'jsdom', - cache: false, - include: ['src/test/javascript/spec/**/*.(spec|test).(ts|tsx)'], - exclude: ['node_modules', 'src/test/javascript/integration/**/*.spec.ts'], - coverage: { - all: true, - thresholds: { - perFile: true, - autoUpdate: true, - 100: true, + globals: true, + logHeapUsage: true, + poolOptions: { + threads: { + minThreads: 1, + maxThreads: 2, + }, }, - include: ['src/main/webapp/app/**/*.ts', 'src/main/webapp/app/**/*.tsx'], - exclude: ['src/main/webapp/app/index.tsx', 'src/main/webapp/app/**/*.d.ts'], - clean: true, - provider: 'istanbul', - reportsDirectory: '{{projectBuildDirectory}}/test-results/', - reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], - watermarks: { - statements: [100, 100], - branches: [100, 100], - functions: [100, 100], - lines: [100, 100], + environment: 'jsdom', + cache: false, + include: ['src/test/javascript/spec/**/*.{test,spec}.?(c|m)[jt]s?(x)'], + coverage: { + thresholds: { + perFile: true, + autoUpdate: true, + 100: true, + }, + include: ['src/main/webapp/**/*.ts?(x)'], + exclude: [ + ...configDefaults.coverage.exclude, + 'src/main/webapp/app/index.tsx', + ], + provider: 'istanbul', + reportsDirectory: '{{projectBuildDirectory}}/test-results/', + reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], + watermarks: { + statements: [100, 100], + branches: [100, 100], + functions: [100, 100], + lines: [100, 100], + }, }, }, - }, -}); + }) +); diff --git a/src/main/resources/generator/client/vue/tsconfig.json b/src/main/resources/generator/client/vue/tsconfig.json index 39819fba5ca..2cd6723983b 100644 --- a/src/main/resources/generator/client/vue/tsconfig.json +++ b/src/main/resources/generator/client/vue/tsconfig.json @@ -18,13 +18,5 @@ "@/*": ["src/main/webapp/app/*"] } }, - "include": [ - "src/main/webapp/**/*.ts", - "src/main/webapp/**/*.d.ts", - "src/main/webapp/**/*.tsx", - "src/main/webapp/**/*.vue", - "src/test/javascript/spec/**/*.ts", - "src/test/javascript/spec/**/*.vue" - ], - "exclude": ["./node_modules"] + "include": ["src/main/**/*", "src/test/javascript/spec/**/*"] } diff --git a/src/main/resources/generator/client/vue/vite.config.ts.mustache b/src/main/resources/generator/client/vue/vite.config.ts.mustache index e69a85715e8..d31ceee890c 100644 --- a/src/main/resources/generator/client/vue/vite.config.ts.mustache +++ b/src/main/resources/generator/client/vue/vite.config.ts.mustache @@ -2,7 +2,6 @@ import { defineConfig } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; import vue from '@vitejs/plugin-vue'; -// https://vitejs.dev/config/ export default defineConfig({ plugins: [vue(), tsconfigPaths()], build: { 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 2c846542b8e..e2a6d026da9 100644 --- a/src/main/resources/generator/client/vue/vitest.config.ts.mustache +++ b/src/main/resources/generator/client/vue/vitest.config.ts.mustache @@ -1,51 +1,50 @@ /// -import { defineConfig } from 'vite'; -import tsconfigPaths from 'vite-tsconfig-paths'; -import vue from '@vitejs/plugin-vue'; +import { mergeConfig, defineConfig, configDefaults } from 'vitest/config' +import viteConfig from './vite.config' -export default defineConfig({ - plugins: [vue(), tsconfigPaths()], - test: { - reporters: ['verbose', 'vitest-sonar-reporter'], - outputFile: { - 'vitest-sonar-reporter': '{{projectBuildDirectory}}/test-results/TESTS-results-sonar.xml', - }, - globals: true, - logHeapUsage: true, - poolOptions: { - threads: { - minThreads: 1, - maxThreads: 2, +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + root: '.', + reporters: ['verbose', 'vitest-sonar-reporter'], + outputFile: { + 'vitest-sonar-reporter': '{{projectBuildDirectory}}/test-results/TESTS-results-sonar.xml', }, - }, - environment: 'jsdom', - cache: false, - include: ['src/test/javascript/spec/**/*.(spec|test).(ts|tsx)'], - exclude: ['node_modules', 'src/test/javascript/integration/**/*.spec.ts'], - coverage: { - thresholds: { - perFile: true, - autoUpdate: true, - 100: true, + globals: true, + logHeapUsage: true, + poolOptions: { + threads: { + minThreads: 1, + maxThreads: 2, + }, }, - exclude: [ - 'src/main/webapp/**/*.component.ts', - 'src/main/webapp/app/main.ts', - '.eslintrc.cjs', - '.lintstagedrc.cjs', - 'src/test/**/*', - '{{projectBuildDirectory}}/**', - ], - provider: 'istanbul', - reportsDirectory: '{{projectBuildDirectory}}/test-results/', - reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], - watermarks: { - statements: [100, 100], - branches: [100, 100], - functions: [100, 100], - lines: [100, 100], + environment: 'jsdom', + cache: false, + include: ['src/test/javascript/spec/**/*.{test,spec}.?(c|m)[jt]s?(x)'], + coverage: { + thresholds: { + perFile: true, + autoUpdate: true, + 100: true, + }, + include: ['src/main/webapp/**/*.ts?(x)'], + exclude: [ + ...configDefaults.coverage.exclude, + 'src/main/webapp/app/main.ts', + 'src/main/webapp/**/*.component.ts', + ], + provider: 'istanbul', + reportsDirectory: '{{projectBuildDirectory}}/test-results/', + reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], + watermarks: { + statements: [100, 100], + branches: [100, 100], + functions: [100, 100], + lines: [100, 100], + }, }, }, - }, -}); + }) +);