From 235e6399d9b44ff3a8a12c9ae467b8e12b1d7b6a Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Fri, 13 Dec 2024 06:48:33 -0700 Subject: [PATCH 1/2] Update exclude details --- docs/writing-tests/test-coverage.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/writing-tests/test-coverage.mdx b/docs/writing-tests/test-coverage.mdx index bb150ef1af5..4f0dd7700a1 100644 --- a/docs/writing-tests/test-coverage.mdx +++ b/docs/writing-tests/test-coverage.mdx @@ -192,7 +192,7 @@ When calculating coverage in the Storybook UI, the following options are always #### Excluding stories from the coverage report -Until Vitest 2.2.0 is released, the generated coverage report will include the stories files themselves. This is misleading and they should be excluded. To do this, you can add the following to your Vitest config: +Until Vitest 3.0.0 is released, the generated coverage report will include the stories files themselves and output from your built Storybook application. This is misleading and they should be excluded. To do this, you can add the following to your Vitest config: ```ts title="vitest.config.ts" import { coverageConfigDefaults, defineConfig } from 'vitest/config'; @@ -205,7 +205,9 @@ export default defineConfig({ exclude: [ ...coverageConfigDefaults.exclude, // This pattern must align with the `stories` property of your `.storybook/main.ts` config - '**/*.stories.*', '**/*.story.*', '**/stories.*', '**/story.*' + '**/*.stories.*', + // This pattern must align with the output directory of `storybook build` + 'storybook-static/**', ], } } From 447426e294cf0854f4173c7a9bc73f7373363a0c Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Fri, 13 Dec 2024 09:05:29 -0700 Subject: [PATCH 2/2] Remove mention of Vitest prompting of coverage support pkgs --- docs/writing-tests/test-coverage.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing-tests/test-coverage.mdx b/docs/writing-tests/test-coverage.mdx index 4f0dd7700a1..1b62f752dfb 100644 --- a/docs/writing-tests/test-coverage.mdx +++ b/docs/writing-tests/test-coverage.mdx @@ -25,7 +25,7 @@ Coverage is included in the Test addon and, when enabled, will be calculated whe ![Screenshot of test module, expanded, showing coverage toggle](../_assets/writing-tests/addon-test-module-edit-coverage.png) -Before coverage can be calculated, you may be prompted to install a support package corresponding to your [coverage provider](#coverage-provider): +Before coverage can be calculated, you may need to install a support package corresponding to your [coverage provider](#coverage-provider): {/* prettier-ignore-start */}