From ee2f5b6ce5b12b70cbff09ca5e51aa28e74a3e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Mino?= Date: Sun, 28 Jul 2024 23:42:49 +0200 Subject: [PATCH] tests --- .../generator/client/react/tsconfig.json | 26 +++++++++---------- .../client/react/vitest.config.ts.mustache | 11 +++----- .../generator/client/vue/tsconfig.json | 10 +------ .../client/vue/vitest.config.ts.mustache | 13 ++++------ 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/src/main/resources/generator/client/react/tsconfig.json b/src/main/resources/generator/client/react/tsconfig.json index e2084baf902..45608f2cdad 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": ["dom", "dom.iterable", "esnext"], + "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..06dd84a8f8e 100644 --- a/src/main/resources/generator/client/react/vitest.config.ts.mustache +++ b/src/main/resources/generator/client/react/vitest.config.ts.mustache @@ -1,6 +1,6 @@ /// -import { defineConfig } from 'vite'; +import { coverageConfigDefaults, defineConfig } from 'vitest/config' import tsconfigPaths from 'vite-tsconfig-paths'; import react from '@vitejs/plugin-react'; @@ -21,18 +21,15 @@ export default defineConfig({ }, environment: 'jsdom', cache: false, - include: ['src/test/javascript/spec/**/*.(spec|test).(ts|tsx)'], - exclude: ['node_modules', 'src/test/javascript/integration/**/*.spec.ts'], + include: ['src/test/javascript/spec/**/*.{test,spec}.?(c|m)[jt]s?(x)'], coverage: { - all: true, thresholds: { perFile: true, autoUpdate: true, 100: true, }, - 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, + include: ['src/main/webapp/**/*.ts?(x)'], + exclude: ['src/main/webapp/app/index.tsx', ...coverageConfigDefaults.exclude], provider: 'istanbul', reportsDirectory: '{{projectBuildDirectory}}/test-results/', reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'], 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/vitest.config.ts.mustache b/src/main/resources/generator/client/vue/vitest.config.ts.mustache index 2c846542b8e..2a8ee01a1d5 100644 --- a/src/main/resources/generator/client/vue/vitest.config.ts.mustache +++ b/src/main/resources/generator/client/vue/vitest.config.ts.mustache @@ -1,6 +1,6 @@ /// -import { defineConfig } from 'vite'; +import { coverageConfigDefaults, defineConfig } from 'vitest/config' import tsconfigPaths from 'vite-tsconfig-paths'; import vue from '@vitejs/plugin-vue'; @@ -21,21 +21,18 @@ export default defineConfig({ }, environment: 'jsdom', cache: false, - include: ['src/test/javascript/spec/**/*.(spec|test).(ts|tsx)'], - exclude: ['node_modules', 'src/test/javascript/integration/**/*.spec.ts'], + 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: [ - 'src/main/webapp/**/*.component.ts', 'src/main/webapp/app/main.ts', - '.eslintrc.cjs', - '.lintstagedrc.cjs', - 'src/test/**/*', - '{{projectBuildDirectory}}/**', + 'src/main/webapp/**/*.component.ts', + ...coverageConfigDefaults.exclude, ], provider: 'istanbul', reportsDirectory: '{{projectBuildDirectory}}/test-results/',