enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

Support for React 17 #2429

Open layershifter opened 4 years ago

layershifter commented 4 years ago

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 ✍️

ljharb commented 3 years ago

@TeoTN no, it wouldn't, because RTL isn't capable of doing all the things enzyme does.

All of your other claims contrasting the two are quite subjective and are quite the opposite of what i've experienced.

einarq commented 3 years ago

@TeoTN It doesn't have to be one or the other, this is a weird tendency in our community I think.

Enzyme is perhaps mostly used as a unit-testing framework, and as such I guess it is more common to have tests that are a bit tied to the implementation.

RTL is more about integration testing imo, and therefore it is much more important that the tests are decoupled from the implementation.

It is of course perfectly possible to create integration tests using Enzyme as well, just takes a bit more discipline I guess since the library isn't as opinionated.

Reminds me of the whole redux vs plain context discussion. These two techniques can be complementary, and both have valid usecases. The important thing is to try to learn when to use which, which is also a bit subjective probably. We all have different experiences.

Thanks for maintaining Enzyme!

TeoTN commented 3 years ago

What I'm saying is that I see real harm in having both competing, especially the issues around adopting newer React versions. My main point is not that RTL does everything and does it better, it's rather that Enzyme is heavily falling behind React and that is an issue - which is not really subjective. E.g. #2282 is dating back to Nov 2019, #2176 to Jun 2019

When maintainers openly say they don't have time for the library, and it has long record of not being compatible with React 16+, it's becoming an issue for community that the path forward is not clear. If it's not maintained actively, why not to send clear message and deprecate it? I'd like to be able to move on and start using something that works with modern React (as hooks were introduced over 2 years ago), without the need to explain in every team why Enzyme won't work for us anymore.

Of course you may disagree with it or simply say that I'm not grateful for the years Enzyme was maintained (which I am) but there's no denying that a major shift has already occurred in the community. It's more obvious as you look at npm downloads (3.7M for RTL vs 2.3M enzyme) and the trends (mostly flatlined for Enzyme and growing for RTL), and I think the decision was already made and is unavoidable. What I'm worried about here is that beyond this point we're all introducing technical debt now. Unless there's a clear path forward but it doesn't seem so, given that React 16 is not fully supported yet and this very issue about React 17 is open for nearly 9 months now, with nothing but unofficial hacks.

ljharb commented 3 years ago

It is maintained actively. “actively” doesn’t mean - for any project - that every issue can or will be fixed, at all or on any particular time schedule.

There is a clear path forward - resolving the relevant issues. The best way to make that happen is to volunteer time to contribute, the second best way is to provide funding. If you’re doing neither, then the only option left to you is patience or to choose another library. This paragraph is true for every open source project.

GenghisKhan commented 3 years ago

This comment was marked as off-topic.

james-reed-toshi commented 3 years ago

The fact that this issue hasn't been resolved in over 1/2 a year just pushed me to move all my testing over to react testing library, so thanks for the nudge.

While tangential to the issue, I think it’s worth noting that if you can use a project like React Testing Library that doesn’t depend on React internals, it’s generally a good idea. At FB we’ve frozen Enzyme tests to stay on an old version of React that won’t be upgraded for this reason, and we banned using it in any new tests. I don’t want to hijack this issue with an unrelated discussion, but for people who feel blocked by this, I want to provide some encouragement that it’s a worthwhile investment to use a different approach.

Hey @gaearon - can I ask, how are you freezing the react version just for enzyme tests and then using a later version for your RTL tests/normal react prod code? This seems like an interesting solution.

lucasgcb commented 3 years ago

Since @wojtekmaj managed to implement a solution for this and branched off with their own package while advertising it here, why hasn't it been incorporated officially yet?

Are there serious breaking issues with it that keep it from being official? If yes, why is their package freely advertised on here? Is it a bureaucratic issue where nobody has time to review it?

It would be nice to have some clarification because when you have developers here saying "there's no need to wait for the official one" it makes it sound like there's a serious lack of context that may cause a lot of stuff to break without people realizing or worse.

ljharb commented 3 years ago

@lucasgcb yes, there are. It’s not advertised, it’s just not censored. The official position of enzyme is, don’t use react 17 yet.

i am the only enzyme developer, to be clear.

lucasgcb commented 3 years ago

@lucasgcb yes, there are. It’s not advertised, it’s just not censored. The official position of enzyme is, don’t use react 17 yet.

i am the only enzyme developer, to be clear.

I see what you mean. Unfortunately, even if your intent was simply "not censoring", this particular Issue Page is by all means advertising their (potentially hazardous) package by being up here uncontested.

This Issue Page is one of the first hits for this problem on search engines and so far that package is the only "solution"; however if it's not supposed to be endorsed, and has glaring issues that keep it from being an official closure, I don't see why it hasn't been snuffed from here yet.

As you can see on this very Issue Page, developers are adding that package as a solution because that's what it looks like. That was what I almost did. This might become a bomb later and I don't think anybody wants that.

ljharb commented 3 years ago

@lucasgcb that's not something i have control over.

If an official package doesn't exist, everyone should always assume it's because the unofficial ones are unacceptable in some way. See #2430 - there's a number of test failures. If those have a fix, then I'll be happy to pull them into that PR - I want nothing more than to release the official react 17 adapter.

chadlavi-casebook commented 3 years ago

i am the only enzyme developer, to be clear.

https://xkcd.com/2347/

mankeheaven commented 3 years ago

Thank you for your contribution

FloMaetschke commented 3 years ago

Hi, is there any progress for react 17 support?

VictorQueiroz commented 3 years ago

What exactly is going on with this? Any updates?

moonray commented 2 years ago

It's been more than a year since the last comment. Is there a timeline for supporting react 17 (and eventually 18)?

ljharb commented 2 years ago

@moonray no, there's no timeline. I have a life and a day job and hundreds of other projects to maintain.

VictorQueiroz commented 2 years ago

I'm really curious about what's the real challenge in supporting React.js 17+. Can someone clarify?

ljharb commented 2 years ago

@VictorQueiroz feel free to take a look at the linked PR, and explore the test failures.

scinos commented 2 years ago

The linked PR has all functional tests passing. The only missing tests are small drops in code coverage. Are those blocking the PR? Anything else? (https://github.com/enzymejs/enzyme/pull/2430#issuecomment-925629823)

ljharb commented 2 years ago

@scinos "time" is always a blocker. I'll try to get back to it soon.

kluplau commented 2 years ago

@scinos "time" is always a blocker. I'll try to get back to it soon.

Let us know if you need assistance.

shye0000 commented 2 years ago

Exactly, depending on what we (my dev team) have seen in this issue, your way on how prioritize your time shows clearly the future of Enzyme and finally made us decided to move on to migrate our existing tests using enzyme to other tools which is perfectly okay for us, anyways we are more like takers from the open source community so that we actually have nothing to complain about, good luck.

GenghisKhan commented 2 years ago

I think this project should be transferred to someone who actually has time to develop and maintain it without waiting to get paid for it.

ThiefMaster commented 2 years ago

@GenghisKhan this kind of comment is quite rude...

GenghisKhan commented 2 years ago

@ThiefMaster It may be but that's most likely the reality.

ljharb commented 2 years ago

@GenghisKhan since zero of those people have actually shown up to do the job in the last 4 years, to whom would you suggest it be transferred?

As for "without waiting to get paid for it", if you're using open source in a company and not funding it, you're being negligent with your fiduciary duty to your company's shareholders; if you're using it outside of a company, help me understand the urgency?

craigkovatch commented 2 years ago

@GenghisKhan since zero of those people have actually shown up to do the job in the last 4 years, to whom would you suggest it be transferred?

As for "without waiting to get paid for it", if you're using open source in a company and not funding it, you're being negligent with your fiduciary duty to your company's shareholders; if you're using it outside of a company, help me understand the urgency?

Does anyone know how to add a "mic drop" reaction in Github? Asking for about 10,000 friends.

shye0000 commented 2 years ago

image

csvan commented 2 years ago

I think this project should be transferred to someone who actually has time to develop and maintain it without waiting to get paid for it.

...like you?

VictorQueiroz commented 2 years ago

You know what, transferring the project to someone who is interested in maintaining it does not seem like a bad idea after all.

ljharb commented 2 years ago

@VictorQueiroz again, please show me someone who’s interested in maintaining it, but who hasn’t made PRs for the last 4 years?

csvan commented 2 years ago

@VictorQueiroz so put up or shut up. Check what is left to do, check open issues, take some time from YOUR busy schedule and get working on it. This is open source, nobody owes you anything, and you should be grateful for the work which actually HAS been done.

VictorQueiroz commented 2 years ago

@csvan The issue is open for comments and I can use this feature. And I will! So why don't you shut up? Try working on that resentment before taking that out on strangers.

You're the one acting as if I owed you something. We're all just users and we're trying to understand what is going on and how can we get this project going again. I don't see why are you so pissed about it. It does not mean we're not grateful for open source or the work done so far on this project.

das3in commented 2 years ago

@csvan The issue is open for comments and I can use this feature. And I will! So why don't you shut up? Try working on that resentment before taking that out on strangers.

You're the one acting as if I owed you something. We're all just users and we're trying to understand what is going on and how can we get this project going again. I don't see why are you so pissed about it. It does not mean we're not grateful for open source or the work done so far on this project.

I think the point was that, to get this project going again, you can check and see what's left, check some open issues and submit some PRs.

csvan commented 2 years ago

@VictorQueiroz I am not pissed, you need to calm down.

We're all just users and we're trying to understand what is going on and how can we get this project going again

If only @ljharb had explained that multiple times over, including in the comment directed directly at you. What needs to be done has been clear for a very long time, that you and others do not seem to want to listen to it is another matter.

lukeapage commented 2 years ago

Can you open a new issue to suggest adding maintainers rather than continue to comment here. It would be great to keep the issues seperate so we can just follow updates.

ljharb commented 2 years ago

@VictorQueiroz @csvan open for comments doesn’t mean it’s appropriate to be hostile or insulting. In particular, suggesting the sole regular CONTRIBUTOR - not even just the sole maintainer - isn’t the best person to do the work is bizarre.

The project never stopped going, so there’s nothing to get going “again”. If you want to help, make no comments on issues - make a PR or post a branch link on an existing PR.

splintor commented 2 years ago

https://dev.to/wojtekmaj/enzyme-is-dead-now-what-ekl

ghost commented 2 years ago

Would it be a capital sin to suggest deprecating this library?

The maintainer has made some interesting points over the year this issue has been open, and to be fair, can we really expect MORE from someone who already maintains over 300 packages?

I'm suggesting that because I feel it would take a massive weight and pressure off of the maintainer's shoulders, would allow him to focus on other stuff he has probably been prioritising over the year this has been open and would allow everyone here to move on with their lives.

tarjei commented 2 years ago

Has anyone created any jscodemods for converting tests to RTL?

(I know the question is a bit OT, but I thought the audience for the question was perfect)

ljharb commented 2 years ago

@pepperrone yes, it would. Please don’t make such a suggestion; it won’t happen.

csvan commented 2 years ago

Instead of talking about deprecating, replacing, changing owners or whatever else will not solve the problem with Enzyme, you (and me!) could talk to your employer about actively sponsoring key open source projects. It is badly needed - way too many companies take the FOSS part of their stack - a HUGE part in most cases - for granted.

TeoTN commented 2 years ago

@csvan

Instead of talking about deprecating, replacing, changing owners or whatever else will not solve the problem with Enzyme, you (and me!) could talk to your employer about actively sponsoring key open source projects. It is badly needed - way too many companies take the FOSS part of their stack - a HUGE part in most cases - for granted.

I don't think throwing money at the project is solution to all of its problems. In fact, I'd even say it would perpetuate some of them.

The reality though is Enzyme has been de facto dead for long now, and it will linger around until everyone eventually finishes their migration to RTL. It will remain a dead project even if hypothetically someone invested insane amounts of time to give it a full rewrite while preserving the API, maybe even ceasing to rely on React's internals for that purpose.

Given the past delays in supporting React 16 & 17 spanning over years, and that the industry has moved on already, including React's core team form the looks of it, I wouldn't expect anyone now to return to Enzyme. At this point I'd call it a risk to any business to rely on it, given the past record.

Perhaps a better moment to invest in the project, and to build a team of maintainers, was in 2019 when hooks were released but this ship has already sailed.

VictorQueiroz commented 2 years ago

@VictorQueiroz @csvan open for comments doesn’t mean it’s appropriate to be hostile or insulting. In particular, suggesting the sole regular CONTRIBUTOR - not even just the sole maintainer - isn’t the best person to do the work is bizarre.

The project never stopped going, so there’s nothing to get going “again”. If you want to help, make no comments on issues - make a PR or post a branch link on an existing PR.

@ljharb I'm not the one being hostile, your friend @csvan is! And surprisingly most of his comments are not hidden as "disruptive", even though he's bashing everyone that's not teaching people how they "should be making a PR". We're just curious and I guess you can understand that in the same way, we can understand you're not paid for doing this and there are no guarantees for us here.

I don't see what is the point in saying that this project is still going when you have an issue like this one. It seems to me, that the only thing "going" here is this issue and the old React.js adapters.

Would it be a capital sin to suggest deprecating this library?

The maintainer has made some interesting points over the year this issue has been open, and to be fair, can we really expect MORE from someone who already maintains over 300 packages?

  • There are a couple of PRs for this issue that also seem to have gone stale.
  • It is quite unlikely that companies will suddenly start pouring money over here, and that probably wouldn't help either since the main factor Jordan has struggled with is time.
  • There are 258 reported issues and 31 PRs, by following this issue for over a year I'm confident that it is unlikely that number will go down to something manageable.
  • It seems to be that a lot of people have migrated to RTL and are happy with it.

I'm suggesting that because I feel it would take a massive weight and pressure off of the maintainer's shoulders, would allow him to focus on other stuff he has probably been prioritising over the year this has been open and would allow everyone here to move on with their lives.

@pepperrone You made a great point and posted a helpful comment, but even then, the owner responded with an extremely rude comment, as usual, about how you "should not make such a suggestion". I think this has become a very hostile situation for us, which is very sad.

It gets me to think when I see all the comments talking about how, in practice, this project is dead. So the owner wants people to keep installing and using this library even though he is no longer able to keep up with it. Why? It doesn't look very transparent to me to try to hide such an important thing from your users.

It seems our best shot is to stop using this library completely and move on to RTL, as suggested here, and BTW, this is a very nice article that those that wish to continue to use this library should read. So I don't see why @splintor's comment was hidden too.

Winning is great, sure, but if you are really going to do something in life, the secret is learning how to lose. Nobody goes undefeated all the time

👍

jukkahyv commented 2 years ago

I think it would be best to move this "is Enzyme dead or not" discussion somewhere else, since it seems very offtopic here, and it's not so simple just migrating to RTL. RTL is integration testing library, Enzyme is more unit testing, they're not same focus.

ljharb commented 2 years ago

@VictorQueiroz it is incredibly rude to suggest someone shut down their own project, especially in that project’s space. It is appropriate to be hostile to someone making that suggestion.

JWBrownie commented 1 year ago

Is this project abandoned??

ljharb commented 1 year ago

@JWBrownie nope.

VictorQueiroz commented 1 year ago

Is this project abandoned??

Yes, @JWBrownie

ljharb commented 1 year ago

@VictorQueiroz no, and don't contradict a maintainer.