-
Notifications
You must be signed in to change notification settings - Fork 233
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
Add ability to run SSR tests in pure-node environment #607
Conversation
It allows to run tests in real node environment, where no DOM global objects exists. Fix: #605
Codecov Report
@@ Coverage Diff @@
## master #607 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 219 218 -1
Branches 28 28
=========================================
- Hits 219 218 -1
Continue to review full report at Codecov.
|
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 good. Have you checked if it resolves the issue in your test?
It would be nice if we could have sone server only tests run in the node
environment without jsdom
to make sure we don't break it in the future, but I'm not sure how we would do that for just some tests? I won't hold this up for it if it too hard though.
@mpeyper yes, i've monkeypatched local version - it solves the issue. About server tests - it is easy with recent jest projects feature (the best they've introduced yet IMO), but here used another test runner so i dont know how to do it here. |
Oh damn, that looks sweet. I'll definitely be investigating that to clean up our bloated test suite. Thanks for the fix, I'll merge this now. New version should be out soon for you (bot will comment here). |
🎉 This PR is included in version 5.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This adds a new test to verify that renderHook can be called in an SSR-like environment based on the changes implemented in testing-library#607.
…er versions of react * refactor(server/pure): remove unnecessary type annotation * feat: add ssr.test.ts This adds a new test to verify that renderHook can be called in an SSR-like environment based on the changes implemented in #607. * chore: update contributors table * refactor: remove act call in render in sever/pure @mpeyper explained how this `act` call in server rendering is not really necessary so we can remove it.
What:
Fix: #605
Why:
Before that change it was impossible to run SSR test in pure-nod eenvironment, where no DOM global objects exists.
How:
Div element now created only in hydration stage (also now it is a marker of hydration occurred)
Checklist: