Skip to content

Commit

Permalink
Fix tags docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Jul 19, 2024
1 parent 5d012d8 commit 05e3c56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Storybook test runner turns all of your stories into executable tests.
- [getHttpHeaders](#gethttpheaders)
- [tags (experimental)](#tags-experimental)
- [logLevel](#loglevel)
- [errorMessageFormatter](#errormessageformatter)
- [Utility functions](#utility-functions)
- [getStoryContext](#getstorycontext)
- [waitForPageReady](#waitforpageready)
Expand Down Expand Up @@ -235,13 +236,15 @@ export default meta;
export const Primary = {};

export const Secondary = {
// will override tags to be just ['skip']
// will combine with meta tags to be ['design', 'test-only', 'skip']
tags: ['skip'],
};
```

> **Note**
> You can't import constants from another file and use them to define tags in your stories. The tags in your stories or meta **have to be** defined inline, as an array of strings. This is a limitation due to Storybook's static analysis.
> You can't import constants from another file and use them to define tags in your stories. The tags in your stories or meta **must be** defined inline, as an array of strings. This is a restriction due to Storybook's static analysis.
For more information on how tags combine (and can be selectively removed), please see the [official docs](https://storybook.js.org/docs/writing-stories/tags).

Once your stories have your own custom tags, you can filter them via the [tags property](#tags-experimental) in your test-runner configuration file. You can also use the CLI flags `--includeTags`, `--excludeTags` or `--skipTags` for the same purpose. The CLI flags will take precedence over the tags in the test-runner config, therefore overriding them.

Expand Down

0 comments on commit 05e3c56

Please sign in to comment.