-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
avoid error "storyshots is intended only to be used with storybook" f… #1441
Conversation
…or transitive dependency on @storybook/react
Codecov Report
@@ Coverage Diff @@
## master #1441 +/- ##
=======================================
Coverage 21.32% 21.32%
=======================================
Files 257 257
Lines 5739 5739
Branches 686 679 -7
=======================================
Hits 1224 1224
- Misses 3981 3993 +12
+ Partials 534 522 -12
Continue to review full report at Codecov.
|
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.
@osdevisnot thanks for your contribution! One thing --
how do I test it on my machine?
Setup storyshots as you normally would, and then remove Without this PR, you should be able to see above error. |
@osdevisnot OK great, thanks! I'll give it a whirl. FYI, |
Aw, I feel stupid.. will be more careful with markdown :( thanks for correcting it. |
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.
I guess that makes sense!
@ndelangen looks like there are some CircleCI config issues when the pull is coming from a fork of our repo? |
Sorry for the delay, LGTM! |
…or transitive dependency on @storybook/react
Issue: When
@storybook/react
is not a direct dependency in package.json - the storyshots fails to execute tests with error "storyshots is intended only to be used with storybook". This is ok in normal circumstances, but limits wrapping "@storybook" into a higher order package.For example: a project depends on a higher order package (maybe CLI tool). this higher order package brings in both
@storybook/react
and@storybook/addon-storyshots
with appropriate config. The storyshots will throw above mentioned error.What I did
Add a fallback check to see if package.json exists before bailing out on dependency being available.
How to test
Tested it by using this package in my project.