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

Support for React 17 #2429

Open
layershifter opened this issue Aug 11, 2020 · 108 comments · May be fixed by #2430 or #2564
Open

Support for React 17 #2429

layershifter opened this issue Aug 11, 2020 · 108 comments · May be fixed by #2430 or #2564
Assignees

Comments

@layershifter
Copy link

An RC for React 17 was released: https://reactjs.org/blog/2020/08/10/react-v17-rc.html

And it does not work with React 17, oops:
image

Working on an isolated repro ✍️

@layershifter
Copy link
Author

A CodeSandbox is ready: https://codesandbox.io/s/cranky-euclid-4qr9z
It's enough to use mount(<div />) to repro it, see index.test.js.

@ljharb
Copy link
Member

ljharb commented Aug 11, 2020

I would never expect enzyme to "just work" with a new major version of React out of the box :-) React breaks things in minors often enough as it is.

First, I have to create an adapter for React 17, and then we'll be able to look at the test failures and go from there.

@layershifter layershifter linked a pull request Aug 12, 2020 that will close this issue
@layershifter
Copy link
Author

layershifter commented Aug 12, 2020

@ljharb I started #2430 as I would like to run tests on React 17 ASAP 😺 Appreciate your eyes on it

@ljharb ljharb self-assigned this Aug 12, 2020
@ljharb
Copy link
Member

ljharb commented Aug 12, 2020

Thanks, but that isn't going to speed anything up. enzyme won't be guaranteed to work on React 17 until it's fully released, not a preview.

@wojtekmaj
Copy link

I think no one expects everything to work right from the start, but it would be nice to just have the adapter preview so we can find bugs early :)

@ljharb
Copy link
Member

ljharb commented Aug 18, 2020

That is certainly my hope and plan, just not something i can commit to, since the react team hasn’t coordinated with me prior to releases in years.

@gaearon
Copy link
Contributor

gaearon commented Aug 19, 2020

It’s fair we haven’t reached out before this particular RC since we generally view an RC as a “reachout” to the whole community. But I believe I did file #2358 (16.14 compatibility). Our plans for 16.14 changed and that release turned into 17 but I’d expect the naming change described in that issue to be the primary one you’d need to address. (Although I could totally be missing something!) Sorry for the frustration.

@ljharb
Copy link
Member

ljharb commented Aug 19, 2020

@gaearon fair point that there's been nonzero efforts, primarily from you personally, which I appreciate. Thanks for pointing me to that issue; I'll incorporate that into the update.

@wojtekmaj
Copy link

wojtekmaj commented Aug 24, 2020

For those impatient ones (myself included), I published @wojtekmaj/enzyme-adapter-react-17 package. It's exactly like enzyme-adapter-react-16, just the necessary bits replaced.

Use it like any other adapter, so:

import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

enzyme.configure({ adapter: new Adapter() });

I tested it on a semi large repository (2000 tests) with no failures, so it should be good enough to use, if the only thing blocking you was a broken adapter.

I will deprecate the package once an official adapter is released. lol

Enjoy!

@trigunam

This comment has been minimized.

@ljharb

This comment has been minimized.

@hengkx
Copy link

hengkx commented Oct 21, 2020

react 17 has been released.

@ljharb
Copy link
Member

ljharb commented Oct 21, 2020

Indeed it has, thanks. I'm still working on getting the adapter set up and passing tests.

@JWBrownie

This comment was marked as spam.

@ljharb

This comment was marked as resolved.

@VictorQueiroz

This comment was marked as abuse.

@ljharb

This comment was marked as resolved.

@aaryn101

This comment was marked as abuse.

@ljharb

This comment was marked as resolved.

@sbaechler

This comment was marked as outdated.

@hoangph271

This comment was marked as resolved.

@ljharb

This comment was marked as resolved.

@VictorQueiroz

This comment was marked as abuse.

@aaryn101

This comment was marked as abuse.

@ljharb

This comment was marked as resolved.

@enzymejs enzymejs locked as off-topic and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet