From 05e3c56f42f2af11779ba0f1a36f0c96d7d0cbb7 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 20 Jul 2024 01:27:08 +0800 Subject: [PATCH] Fix tags docs --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42052c1..0bfb16e 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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.