-
Notifications
You must be signed in to change notification settings - Fork 33
@W-17983974 add SSRv2 support for unit testing #371
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
Conversation
8e6a87c to
95d92b0
Compare
divmain
left a comment
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.
Everything looks good except for the test snapshots. All the __lwc_scope_token__ stuff looks really odd, and I want to confirm that it is intended before merging.
...le-ssr/src/modules/x/basic/__tests__/__snapshots__/basic-data-driven.ssr-server.test.js.snap
Outdated
Show resolved
Hide resolved
test/src/modules/ssr/basic/__tests__/__snapshots__/basic.ssr-test.js.snap
Outdated
Show resolved
Hide resolved
lpomerleau
left a comment
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.
Nice! What are the steps for a component developer to start using SSRv2 unit testing? Do they just need to upgrade their packages?
|
|
||
| const renderedComponent = | ||
| ssrMode !== 'v1' | ||
| ? await serverSideRenderComponent(tagName, Ctor, props) |
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.
We recently turned on style dedupe with serverSideRenderComponent in LWR. Should that be an option here? It will change the SSRed output, but I'm not sure if that matters for the unit tests 🤔
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.
Im not really familiar with style dedupe. @divmain Can you confirm if we need this for unit testing?
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.
My inclination is to wait on style-dedupe for now:
- If we turn it on now, everybody's fixtures will change and their tests will fail.
- If we tell them "your fixtures may change due to style-dedupe" then component owners may simply accept all changes to their fixtures without thinking critically about those changes.
- However, that means any actual SSRv2 issues will be less likely to be caught.
We can turn style-dedupe on sometime in the future, once we're past the initial surge of SSRv2-related issues.
...le-ssr/src/modules/x/basic/__tests__/__snapshots__/basic-data-driven.ssr-server.test.js.snap
Outdated
Show resolved
Hide resolved
Yes they need to update the tooling version in the package and update the calls to |
Co-authored-by: Dale Bustad <[email protected]>
divmain
left a comment
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! Thank you!
|
|
||
| const renderedComponent = | ||
| ssrMode !== 'v1' | ||
| ? await serverSideRenderComponent(tagName, Ctor, props) |
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.
My inclination is to wait on style-dedupe for now:
- If we turn it on now, everybody's fixtures will change and their tests will fail.
- If we tell them "your fixtures may change due to style-dedupe" then component owners may simply accept all changes to their fixtures without thinking critically about those changes.
- However, that means any actual SSRv2 issues will be less likely to be caught.
We can turn style-dedupe on sometime in the future, once we're past the initial surge of SSRv2-related issues.
No description provided.