@@ -53,36 +53,49 @@ const aliasPaths = paths
5353 : [ ] ;
5454
5555export default defineConfig ( {
56- plugins : [
57- react ( ) ,
58- cssInjectedByJsPlugin ( ) , // CSS transformation: CSS/Image handling in Jest's transform.
59- ] ,
56+ plugins : [ react ( ) , cssInjectedByJsPlugin ( ) ] ,
6057 test : {
6158 environment : 'jsdom' ,
6259 globals : true , // Makes test, expect, vi global
6360 setupFiles : [ './vitest-setup.ts' ] ,
6461 cache : {
6562 dir : '../../.cache/hobbies-helsinki/vitest' , // Vitest specific cache
6663 } ,
67- include : [ 'src/**/*.{spec,test}.{js,jsx,ts,tsx}' ] , // Match your Jest testMatch
64+ include : [ 'src/**/*.{spec,test}.{js,jsx,ts,tsx}' ] ,
6865 exclude : [ ...configDefaults . exclude , './.next/' , '/__mocks__/' ] ,
69- // Optional: Configure coverage if needed (equivalent to Jest's collectCoverageFrom, coverageDirectory)
70- // coverage: {
71- // provider: 'v8', // or 'istanbul'
72- // reporter: ['json', 'html', 'text'],
73- // include: ['src/**/*.{ts,tsx,js,jsx}'],
74- // exclude: [
75- // 'src/**/*.test.ts',
76- // 'src/.next/**',
77- // // Add other patterns from Jest's coveragePathIgnorePatterns if needed
78- // // Be careful with node_modules here, Vitest handles them differently
79- // ],
80- // },
81- // deps: {
82- // interopDefault: true, // Helps with CommonJS default exports
83- // Force these packages to be transformed
84- // inline: ['react-helsinki-headless-cms', '@apollo/client', '@next/env'],
85- // },
66+ reporters : [ 'json' , 'verbose' , 'vitest-sonar-reporter' ] ,
67+ outputFile : {
68+ json : 'sonar-report.json' ,
69+ 'vitest-sonar-reporter' : 'sonar-report.xml' ,
70+ } ,
71+ coverage : {
72+ provider : 'v8' , // or 'istanbul'
73+ reporter : [ 'lcov' , 'html' , 'text' ] ,
74+ include : [ 'src/**/*.{ts,tsx,js,jsx}' ] ,
75+ exclude : [
76+ 'src/**/*.test.ts' ,
77+ 'src/.next/**' ,
78+ '**/*.d.ts' ,
79+ '**/*.json' ,
80+ '**/*.xml' ,
81+ '**/*.yaml' ,
82+ '**/*.md' ,
83+ '**/*.html' ,
84+ '**/*.css' ,
85+ '**/*.properties' ,
86+ '*.config.*js' ,
87+ 'node_modules/' ,
88+ 'browser-tests/' ,
89+ 'build/' ,
90+ 'codegen.ts' ,
91+ 'src/index.tsx' ,
92+ '**/__tests__/**' ,
93+ '**/__snapshots__/**' ,
94+ '**/*.test.ts' ,
95+ '**/*.spec.ts' ,
96+ '**/query.ts' ,
97+ ] ,
98+ } ,
8699 } ,
87100 resolve : {
88101 alias : [
0 commit comments