-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
CMS 5: Update jest tests to work with react 18 #1 #1419
Comments
I've done a trial of converting campaign-admin to use react-testing-library. First, a few clarifications about libraries:
Note about react-testing-library queries:
Migration is still easy
|
Update on asset-admin Different experience, not so good. Lots of tests in AssetDropzone-test.js are testing need to both render() the component in order to be the third party new DropzoneLib() to get rendered into the DOM, AND test the internals. We can't do both at the same time using react-testing-utils. Looks we'll need to do additional work refactor a some of the tests so that they're testing the rendered output rather than internals Some of these some of these tests are questionable, e.g. testing or directly modifying the internals of |
I had a go at preserving the existing tests by only using the old ReactTestUtils which still functions, though it's on life support. It did work though it told me it red output in my terminal it would behave like react 17. IMO That's worse than our current solution of using react 16 without red warnings everywhere. I did try to making a custom render() method life so that we could use in the jest test files.
And while that renders, This is consistent with All this is really pointing to the fact that we're going to need to refactor or just remove a decent chunk of the jest tests which require access to the rendered component. |
PRs merged |
Our javascript tests currently are incompatible with react 18 - both
enzyme
andreact-dom/test-utils
simply don't work with react 18, and no doubt there are other bits and pieces of test architecture we'll need to replace as well.I tried replacing the above with the official react testing library but the fundamental philosophy of that library is incompatible with a large portion of our tests. The reality is we're going to have to rethink what we're testing and probably rewrite a considerable portion of it.
I have temporarily added a workaround to let the tests run using react 16 - but obviously that means if there's some failure that's specific to react 18 we're not going to catch it.
Acceptance criteria
New issues created
PRs
The text was updated successfully, but these errors were encountered: