-
Notifications
You must be signed in to change notification settings - Fork 34
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
[Bug] Story-level tags are ignored in Vitest integration #261
Comments
Is it only |
Good question. Initially I wonder if extracting the |
Would manually appending the
Ah yes, that's a problem. I can think of two solutions for now:
|
Describe the bug
When using the new Vitest integration via
@storybook/experimental-addon-test
, the way to skip specific stories from being tested is by removing the'test'
tag. This is done by setting'!test'
on a story:Tags work fine in Storybook UI because the Svelte CSF indexer parses them via static analysis, but the indexer doesn't run in Vitest mode (it doesn't need to).
Instead, the Vitest plugin from
@storybook/experimental-addon-test
uses theCsfFile
construct to statically analyse the (compiled) CSF file. But because tags aren't part of the compiled output of Svelte CSF, they aren't detected during static analysis.This is only a problem for story-level tags, meta or preview level tags are parsed correctly.
Steps to reproduce the behavior
npx storybook@next add @storybook/experimental-addon-test@next
npm run test --project storybook
'!test'
tag to a storyAdditional context
CsfFile
parses tags here: https://github.com/storybookjs/storybook/blob/next/code/core/src/csf-tools/CsfFile.ts/#L626-L631And here are the tests that showcases what it supports: https://github.com/storybookjs/storybook/blob/next/code/core/src/csf-tools/CsfFile.test.ts/#L1278-L1375
The solution is to make sure tags are part of the compiled Svelte CSF.
Today we have:
We could change that to one of the three:
OR:
OR:
All would work, we should just do what is simplest to implement.
The text was updated successfully, but these errors were encountered: