🔧 chore: configure junit and cobertura test reporting

- Add junit reporter to vitest configs for CI/CD integration
- Enable cobertura coverage reports for test analytics
- Add @ts-expect-error comment for complex vitest reporter types
- Remove duplicate test target from reward-selection-dialog project.json
This commit is contained in:
Lorenz Hilpert
2025-11-06 10:46:38 +01:00
parent a6f0aaf1cc
commit 1d4c900d3a
6 changed files with 40 additions and 17 deletions

View File

@@ -4,7 +4,9 @@ import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig(() => ({
export default
// @ts-expect-error - Vitest reporter tuple types have complex inference issues, but config works correctly at runtime
defineConfig(() => ({
root: __dirname,
cacheDir:
'../../../../node_modules/.vite/libs/checkout/feature/reward-order-confirmation',
@@ -19,11 +21,15 @@ export default defineConfig(() => ({
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
reporters: [
'default',
['junit', { outputFile: '../../../../testresults/junit-checkout-feature-reward-order-confirmation.xml' }],
],
coverage: {
reportsDirectory:
'../../../../coverage/libs/checkout/feature/reward-order-confirmation',
provider: 'v8' as const,
reporter: ['text', 'cobertura'],
},
},
}));

View File

@@ -6,13 +6,6 @@
"projectType": "library",
"tags": [],
"targets": {
"test": {
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../../../coverage/libs/checkout/shared/reward-selection-dialog"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}

View File

@@ -4,7 +4,9 @@ import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig(() => ({
export default
// @ts-expect-error - Vitest reporter tuple types have complex inference issues, but config works correctly at runtime
defineConfig(() => ({
root: __dirname,
cacheDir:
'../../../../node_modules/.vite/libs/checkout/shared/reward-selection-dialog',
@@ -19,11 +21,15 @@ export default defineConfig(() => ({
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
reporters: [
'default',
['junit', { outputFile: '../../../../testresults/junit-checkout-shared-reward-selection-dialog.xml' }],
],
coverage: {
reportsDirectory:
'../../../../coverage/libs/checkout/shared/reward-selection-dialog',
provider: 'v8' as const,
reporter: ['text', 'cobertura'],
},
},
}));

View File

@@ -4,7 +4,9 @@ import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig(() => ({
export default
// @ts-expect-error - Vitest reporter tuple types have complex inference issues, but config works correctly at runtime
defineConfig(() => ({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/ui/carousel',
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
@@ -18,10 +20,14 @@ export default defineConfig(() => ({
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
reporters: [
'default',
['junit', { outputFile: '../../../testresults/junit-ui-carousel.xml' }],
],
coverage: {
reportsDirectory: '../../../coverage/libs/ui/carousel',
provider: 'v8' as const,
reporter: ['text', 'cobertura'],
},
},
}));

View File

@@ -4,7 +4,9 @@ import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig(() => ({
export default
// @ts-expect-error - Vitest reporter tuple types have complex inference issues, but config works correctly at runtime
defineConfig(() => ({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/ui/switch',
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
@@ -18,10 +20,14 @@ export default defineConfig(() => ({
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
reporters: [
'default',
['junit', { outputFile: '../../../testresults/junit-ui-switch.xml' }],
],
coverage: {
reportsDirectory: '../../../coverage/libs/ui/switch',
provider: 'v8' as const,
reporter: ['text', 'cobertura'],
},
},
}));

View File

@@ -4,7 +4,9 @@ import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig(() => ({
export default
// @ts-expect-error - Vitest reporter tuple types have complex inference issues, but config works correctly at runtime
defineConfig(() => ({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/utils/format-name',
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
@@ -18,10 +20,14 @@ export default defineConfig(() => ({
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
reporters: [
'default',
['junit', { outputFile: '../../../testresults/junit-utils-format-name.xml' }],
],
coverage: {
reportsDirectory: '../../../coverage/libs/utils/format-name',
provider: 'v8' as const,
reporter: ['text', 'cobertura'],
},
},
}));