-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Emit messages when stories fail to render #3967
Conversation
Generated by 🚫 dangerJS |
Please explain why the Would a try-catch decorator work here? |
Sorry, that was a bit low on detail. So the React integration has some code that calls I think we need a story that results in |
What do you think @ndelangen? Also any thoughts on how to test it? |
@ndelangen it might make more sense to only apply it to "Components|..." story, I think I am right in saying these are the only ones where it matters?
Codecov Report
@@ Coverage Diff @@
## master #3967 +/- ##
==========================================
+ Coverage 39.66% 41.68% +2.02%
==========================================
Files 433 433
Lines 5445 5421 -24
Branches 740 739 -1
==========================================
+ Hits 2160 2260 +100
+ Misses 2903 2796 -107
+ Partials 382 365 -17
Continue to review full report at Codecov.
|
I added a test and sorted out the theming thing (let me know if you are happy with that @ndelangen) |
@igor-dv these stories I've added are guaranteed to fail storyshots, as they throw errors after all ;) I want to change them to not be included in our storyshots test suite. I can do this via looking into .add('error', () => null, { storyshots: { disable: true } }) Maybe this is a separate PR, but I am wondering if we can work together to add that API to storyshots? I think we need to tweak the way it gets stuff out of the store for it to have direct access to a stories parameters |
Yeah, it's a nice API. What if you would like to exclude stories from one test but include them into another one? |
Do you mean in a different "suite"? We could also add something like |
We would probably need to render these stories inside the manager UI for this to make sense in Chromatic (which detects errors)
This is ready to merge I think, we can add the params API to storyshots later #4010 |
I'm confused... is this now a feature of storyshots? |
Issue:
There is no way for external tools or the manager context to know when a story fails to render
What I did
Emitted two events when the story errors or throws.
How to test
I added stories for the two cases, however there are a couple of problems/questions:
The current use of emotion's
ThemeProvider
in official storybook means that my "error" story ends up throwing rather than triggering the react layer's error code. Any ideas on how to work around this @ndelangen? -- I don't want this decorator to apply for this story -- Perhaps we need to do something hacky likeaddDecorator(story, ({kind})) => kind === 'Errors' ? story() : <ThemeProvider>...)
I'd like to also throw the error if the story throws sometime after the initial render. Is this out of scope? It would be useful for Chromatic to know that a component has errored even if it does it async. This would require work from all the view layers so perhaps is a separate PR. Could be out of scope for storybook in any case.
Is there a way to test the event is emitted correctly?