You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible today to test a server-rendered component? My understanding is render will return a mounted component with all initial JS ran (top-level <script>, effects and use: actions).
At the moment, this library is very much concerned with testing the client-side behavior of components. It's difficult for client rendering and server rendering to co-exist in the same suite/Vitest workspace.
Additionally, most of the utility of this library involves setting up the testing-library queries in a DOM environment and cleaning up said DOM. Without the DOM, this library doesn't add much on top of calling Svelte's mount function.
You may want to explore using svelte/server directly in your tests. I'd be curious to hear how you go with it just in case there is interesting / helpful stuff we could wrap! The Vitest setup for such a thing might be a little involved, so happy to help out as needed
Is it possible today to test a server-rendered component? My understanding is
render
will return a mounted component with all initial JS ran (top-level<script>
, effects anduse:
actions).If not, it would be helpful to be able to test a server-rendered component easily; maybe as part of
render
results: https://testing-library.com/docs/svelte-testing-library/api/#render-resultsThe text was updated successfully, but these errors were encountered: