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

Migrate useWindowSize tests to @testing-library/react #1377

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xobotyi
Copy link
Contributor

@xobotyi xobotyi commented Sep 18, 2023

As @testing-library/react-hooks library is abandoned and forces users to switch to @testing-library/react simple switch of react versions implies adapting most of tests.

The library change is not a drop-in threfore requires manual rewriting all tests accroding to [migration guide]

As @testing-library/react do not offer a solution for SSR hooks testing - i made an ssr harness which i'm planning to extract to separte package lately when all tests moved and harness will prove to be viable.

@xobotyi
Copy link
Contributor Author

xobotyi commented Sep 18, 2023

@JoeDuncko @ArttuOll requesting some help with this one.
I'll go from bottom, from useWindowSize to useQueue

@xobotyi xobotyi changed the title React 18 migration Migrate some tests to @testing-library/react Oct 5, 2023
@xobotyi xobotyi changed the title Migrate some tests to @testing-library/react Migrate useWindowSize tests to @testing-library/react Oct 5, 2023

triggerResize('width', 200);
triggerResize('height', 200);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xobotyi Why did we changed it to hieght from width?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, to be fair =) it is not intended

There is still an issue with harness - have to rewrite it

@malavshah9
Copy link

@xobotyi Wanted to contribute in this migration.
Suggest me a approach by which

  1. We can modularly collaborate
  2. I can participate in Hacktoberfest

@xobotyi
Copy link
Contributor Author

xobotyi commented Oct 15, 2023

Main issue is that i dont know how to properly migrate to react 18. ideally we have to migrate first to @testing-library/react but it requires writing own hook harness and heavily depends on react version.

So it seems that ill have to swrite harnesses for react 17, then migrate all tests to @testing-library/react and then switch to react 18 with rewriting harnesses to support react 18.

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

Successfully merging this pull request may close these issues.

None yet

2 participants