Skip to content

Commit

Permalink
Docs: Adds troubleshooting for test flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniebigodes committed Dec 19, 2023
1 parent aacb3fb commit e3cf322
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
| `debug` | Enables the debug mode, providing additional logging information during the instrumentation process. | `boolean` | - |

> **Note:**
> If you're using typescript, you can import the type for the options like so:
> If you're using TypeScript, you can import the type for the options like so:
>
> ```ts
> import type { AddonOptionsWebpack } from "@storybook/addon-coverage";
Expand All @@ -77,12 +77,42 @@ export default {
| `nycrcPath ` | Path to specific nyc config to use instead of automatically searching for a nycconfig. This parameter is just passed down to @istanbuljs/load-nyc-config. | `string` | `-` |
> **Note:**
> If you're using typescript, you can import the type for the options like so:
> If you're using TypeScript, you can import the type for the options like so:
>
> ```ts
> import type { AddonOptionsVite } from "@storybook/addon-coverage";
> ```
## Troubleshooting
### The coverage addon doesn't support optimized builds
The `--test` flag is designed to be as fast as possible, removing addons known to slow down the build and are not needed for functional testing. One of these addons is `@storybook/addon-coverage`, which is used in conjunction with the Storybook Test runner to collect coverage information for your stories.
If you are using `addon-coverage` **AND** running the test runner against your _built_ Storybook, the `--test` flag will strip out the coverage information. To configure the `--test` build to keep coverage information (at the expense of a slightly slower build), update your Storybook configuration file (i.e.,`.storybook/main.js|ts`) and include the [`disabledAddons`](https://storybook.js.org/docs/api/main-config-build#testdisabledaddons) option.
```js
// main.js
export default {
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-coverage',
],
build: {
test: {
disabledAddons: [
'@storybook/addon-docs',
'@storybook/addon-essentials/docs',
],
},
},
}
```
### Development scripts
- `yarn start` runs babel in watch mode
Expand Down

0 comments on commit e3cf322

Please sign in to comment.