Open jwerre opened 1 year ago
I don't know all the details regarding story indexers and the test runner, but there's a chance this could be implemented more generally, if the test-runner supported users' custom story indexers - like the one from addon-svelte-csf
.
It turns out this currently works, but requires the --index-json
flag. I tested it out in your repro and it correctly passed one test. npm run test-storybook -- --index-json
.
Could you test this out in your own more complex setup and let us know if it works there too?
I just tried this locally and it worked! I'll push this up to my CI today and check there.... will be in touch.
Using the index.json mode has its limitations, mainly that watch mode isn't supported, because it doesn't run directly on the filesystem but rather on the story index, so there's no way to know when something has changed.
We've looked into this, and the way custom story indexers (like addon-svelte-csf
) needs to be implemented makes it very hard to get around these limitations. So for now, this is the workaround we recommend. This might change in the future, we're considering improving the support for custom story indexers in Storybook core.
It's not a big deal, since, if you're working locally, the test run in the Interactive panel on save. I was mostly looking for something to run my tests in CI which this solves.
Describe the bug
The test runner doesn't work with Svelte CSF which is essential for making Svelte components with Storybook.
Steps to reproduce the behavior
git checkout csf3
npm test
- see tests passgit checkout svelte
npm test
- see tests failExpected behavior
This repo has the same story, one written in CSF3 while the other is written in Svelte CSF. The CSF3 story passes but the Svelte story fails
Screenshots and/or logs
Environment