Skip to content
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

Fix JS tests to work with React 17 and 18 #20007

Closed
igorschoester opened this issue Mar 14, 2023 · 2 comments
Closed

Fix JS tests to work with React 17 and 18 #20007

igorschoester opened this issue Mar 14, 2023 · 2 comments

Comments

@igorschoester
Copy link
Member

igorschoester commented Mar 14, 2023

React can only be present once on a page. Therefor, in WP, we are reliant on whatever version is included there.
To make this happen we have this configured as external, plus use the WP element package.

However, WP element is set to an older version in our code. This version still uses React 16.
For our built code this does not matter, due to the external. But for our tests, it does.
It turns out our tests start failing if we upgrade WP element to a version that is used in WP 6.2 (see #20003)

This issue is meant to tackle our JS tests, to let them work with React 17 or even 18.
Bonus points for upgrading our React version in the process.

Some more tech info:

  • Regarding our test suite
  • Dependencies in packages might conflict with those in the root. Could investigate nohoist here
@vraja-pro
Copy link
Contributor

Problem: JS lint test doesn't recognise import of createReduxStore and register from @wordpress/data.
Possible reason: We are not bundling @wordpress/data in the zip, and we rely on window object instead.
Temporary solution: We added ignore lint comment for that import in both packages/js/src/settings/store/index.js and packages/js/src/academy/store/index.js. Search for import/named for other instances.

@igorschoester
Copy link
Member Author

Replaced by #20593

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants