-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
test: several fixes for the design-system test framework #16502
Conversation
Thanks for taking the time to open a PR!
|
@@ -66,7 +67,7 @@ const tree: TreeParent = { | |||
], | |||
} | |||
|
|||
export const VirtualizedTree = createStory(() => { | |||
export const VirtualizedTree: Story = createStory(() => { |
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 cast should be unnecessary
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.
It actually is, because createStory returns Story<unknown>
I am wondering what would type the Story here.
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 updated utils.ts
a bit so that they become unnecessary.
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
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.
👀
@@ -8,7 +8,7 @@ export const createStorybookConfig = (config: Meta): Meta => config | |||
/** | |||
* Compact way of declaring a new story | |||
*/ | |||
export const createStory = <T>(template: Story<T>, args?: Partial<T>) => { | |||
export const createStory = <T = any>(template: Story<T>, args?: Partial<T>): Story<T> => { |
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.
Why is the default of any
necessary? Can't you just omit that?
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 did not find out how to.
If I do omit that, TypeScript makes it an unknown
which will in turn give me unknown
again when inferring the type for the Cypress mount()
function... and will error
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.
No matter what I try, I can't seem to get this working :(
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.
Ah, I figured out why it's being weird. I disabled TypeScript on the specs in the tsconfig
, which means TS wasn't trying very hard to properly show the types. Removing the exclude
clause has everything work correctly without these type changes (although you might want to change the default value of T
to {}
:
createStory = <T = {}>(...) => {...}
@storyboook/testing-react
from canary to 0.12.0FileTree/index.ts
instead of the one that is in the dist folder in the test