Skip to content

How do you set up unit for web components generated using Preact? #4133

Answered by rschristian
zarahzachz asked this question in Q&A
Discussion options

You must be logged in to vote

Other resources say I have to have explicit hydration steps set up in our unit tests to test the web components by importing hydrate from Preact.

Have a link for that by any chance? You only need to start thinking about hydration if you're using SSR (and DSD w/ web components), however, that isn't something you'd usually see in a unit test.

You shouldn't need any additional configuration for Jest from Preact's side here, we're just taking a standard component and registering it as a custom element, though I'm not sure how well web components play with JSDOM and the like.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zarahzachz
Comment options

Answer selected by zarahzachz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants