generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Adds troubleshooting for test flag #36
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"; | ||
|
@@ -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', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needed in the snippet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, based on the comment from Shilman. I tested it out and was able to see the issue and the fix. |
||
], | ||
}, | ||
}, | ||
} | ||
``` | ||
|
||
### Development scripts | ||
|
||
- `yarn start` runs babel in watch mode | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add the whole list, or the addons field at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can tweak the addons—no problem at all there. I just copied them over from an existing reproduction.