From 6d75630fcc917310804e710ca9ea705e5e7c8ea6 Mon Sep 17 00:00:00 2001 From: The Jared Wilcurt Date: Sun, 4 Dec 2022 13:38:16 -0500 Subject: [PATCH] docs: setting for coverage reports directory (#2400) * Document setting the coverage reports directory This took a lot of trial and error to get to work, so it should be documented to save other people the 2 hours of research it took me to get it working. * Apply suggestions from code review * Apply suggestions from code review * Update docs/guide/coverage.md Co-authored-by: Anjorin Damilare * Update docs/guide/coverage.md Co-authored-by: Anjorin Damilare --- docs/guide/coverage.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guide/coverage.md b/docs/guide/coverage.md index 5050c801e79f..9d9c051b975c 100644 --- a/docs/guide/coverage.md +++ b/docs/guide/coverage.md @@ -89,6 +89,22 @@ export default defineConfig({ Please refer to the type definition for more details. +## Changing the default coverage folder location + +When running a coverage report, a `coverage` folder is created in the root directory of your project. If you want to move it to a different directory, use the `test.coverage.reportsDirectory` property in the `vite.config.js` file. + +```js +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + coverage: { + reportsDirectory: './tests/unit/coverage' + } + } +}) +``` + ## Ignoring code Both coverage providers have their own ways how to ignore code from coverage reports.