Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
murdos committed Jul 29, 2024
1 parent 2dd999a commit ccac3e3
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 108 deletions.
26 changes: 12 additions & 14 deletions src/main/resources/generator/client/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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/**/*"]
}
82 changes: 42 additions & 40 deletions src/main/resources/generator/client/react/vitest.config.ts.mustache
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
/// <reference types="vitest" />

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],
},
},
},
},
});
})
);
10 changes: 1 addition & 9 deletions src/main/resources/generator/client/vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
87 changes: 43 additions & 44 deletions src/main/resources/generator/client/vue/vitest.config.ts.mustache
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
/// <reference types="vitest" />

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],
},
},
},
},
});
})
);

0 comments on commit ccac3e3

Please sign in to comment.