-
Notifications
You must be signed in to change notification settings - Fork 44
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
Support storybook preview file #792
Conversation
🦋 Changeset detectedLatest commit: 98de0e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
b6c0997
to
03562ae
Compare
So, because we're now making/cleaning up symlinks when starting/building storybook, when running multiple storybooks at once, which happens when running sku's tests, there's a possibility that a symlink could be created by one instance but cleaned up by another, so storybook throws an error because it can't resolve the file. I think the best solution to this would be to move all storybook tests to a single fixture, probably |
|
febc07d
to
c520623
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.
👋
); | ||
|
||
expect(text).toEqual('Braid Text decorator'); | ||
expect(fontSize).toEqual('16px'); |
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.
one day.... maybe one day.... but should be fine for the foreseeable future.
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.
Nicely done 🍒 🐎
* If 1 file is found, a symlink is created to it from the provided storybook config directory. | ||
* Does nothing if 0 or >1 files are found. | ||
* | ||
* @param {string} storybookConfigDirectory The path to the storybook config directory |
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 find your lack of respect for the Storybook brand name disturbing.
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.
sToRyBoOk
Co-authored-by: Remus Mate <rmate@seek.com.au>
With the deprecation (and future removal) of the
storiesOf
API, the best place for global configuration of stories is thepreview.js
file. See the storybook docs for more info about what this file can be used for.This PR adds support for storybook's
preview.(js|ts|tsx)
file. When runningsku storybook
orsku build-storybook
, if a preview file is detected in the.storybook
folder relative to the sku config folder, a symlink will be created in sku's storybook config directory that points to the preview file.I also removed the decorator that sku was injecting into every story. This was required in order to render text correctly, back when we were still using basekick. It was kept when we moved to capsize, but isn't actually needed. Not marking this as a breaking change as it won't affect any projects other than Braid, and even then it will only result in some screenshot diffs with a few border pixels missing.
I've also optimized the storybook test utilities so we can re-use the same iframe that puppeteer gives us between tests. We test the same story in each test anyway. Previously, each storybook test was opening the page, clicking a button, getting the story iframe, and then running a selector on the iframe. This resulted in each test taking about 1-2s (on my machine). Now that we're re-using the same iframe between tests, each test takes a few milliseconds.
EDIT: Looks like a similar test speedup on CI too 🏎️