From 296638c2e3b57fdfad6d75cccea192cb8c0c8f14 Mon Sep 17 00:00:00 2001 From: Hannes Michalek Date: Mon, 16 Dec 2024 11:49:01 +0100 Subject: [PATCH] Add coverage settings --- frontend/vitest.config.ts | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/frontend/vitest.config.ts b/frontend/vitest.config.ts index c328717..deedaf2 100644 --- a/frontend/vitest.config.ts +++ b/frontend/vitest.config.ts @@ -9,6 +9,46 @@ export default mergeConfig( environment: 'jsdom', exclude: [...configDefaults.exclude, 'e2e/**'], root: fileURLToPath(new URL('./', import.meta.url)), + coverage: { + provider: 'v8', + reporter: ['lcov', 'text', 'html'], + // Changes to this also need to be reflected in the sonar-project.properties + exclude: [ + // Configuration and generated outputs + '**/[.]**', + 'coverage/**/*', + 'dist/**/*', + '**/.*rc.{?(c|m)js,yml}', + '*.config.{js,ts}', + + // Types + '**/*.d.ts', + + // Tests + 'test/**/*', + 'e2e/**/*', + + // App content we're not interested in covering with unit tests. If you + // add something here, please also add a comment explaining why the + // exclusion is necessary. + + // Views are too complex too set up and mock in unit tests, we're covering + // those with E2E test instead. (App is also a view) + 'src/views/**/*', + 'src/App.vue', + + // If necessary to use e.g. guards, we'll have a router-guards file that + // then should be tested + 'src/router.ts', + + // Just the init file, nothing much to test here. + 'src/main.ts', + + // Stories are just for internal development use and don't need to be + // tested + 'src/**/*.story.vue', + ], + }, }, }), )