-
-
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
CSF: Expose story id in composeStories #22471
CSF: Expose story id in composeStories #22471
Conversation
d8abe7e
to
462e5a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me! Thank you for such detailed explanation of your use case 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me! Thank you for such detailed explanation of your use case 👍
@yannbf thanks for the feedback, please let me know in case there is any action item on me, to get the PR in. Otherwise looking forward to it being merged and released! |
CSF: expose story id in composeStories testing utility
What I did
In this PR we expose story id when using
composeStory/composeStories
. We do that to be able to identify a story when running unit tests. You can check https://github.com/microsoft/nova-facade/pull/72/files#diff-220d974cd0e74b45dc745889f0752372189a35d53bc122ac00ec3f52edf7063f to see what it can be used for. In this case we have a decorator which for each story saves something in module state. To be able to interact with that entity insideplay
function we need to be able to identify a story somehow and such identifier can be used as a key for that store (and relying on id instead of manually setting thestoryName
). To be honest my preferred solution would be to just add the information from decorator toparameters
(in case of that PR, to setenvironment
as another parameter from within decorator). But as discussed in #21252 (comment), it seems that changes to parameters are not visible inplay
function and I am not sure how long it would take for the behavior to be fixed. Therefore, this PR is a workaround but IMO also provides a nicer way to setup context forplay
function from within unit tests.@yannbf, @tmeasday I am looking forward to hear your thoughts on this!
How to test
Check the added unit tests, to see the exposed ids.
Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]