Enzyme: react-addons-test-utils is deprecated since React 15.5.0

Created on 8 Jun 2017  路  9Comments  路  Source: enzymejs/enzyme

See package description https://www.npmjs.com/package/react-addons-test-utils

Enzyme should also move to react-dom/test-utils

Most helpful comment

I've been chasing this problem for a few days too.

Found something that works today; removed react-addons-test-utils, which then caused enzyme to start throwing the error linked in https://github.com/airbnb/enzyme/blob/master/src/react-compat.js#L115 about needing react-test-renderer. Installing that then removed the console errors from my test runs.

Sorry, that's probably not much help, but it's all the detail I have.

All 9 comments

Thank you, I checked this sources. Looks like there are no way yet to use enzyme with react 16? I mean ReactNative has been on React 16 for months and I used it successfully with enzyme, but recently they updated react to 6.0.0-alpha.12 and since then I can't run tests with enzyme.
I mean probably this condition shouldn't be like === 15.5, but something like >= 15.5?

No, React 16 doesn't exist yet - just the alpha, and we don't support alphas.

It was a really bad idea for RN to require an alpha version of React, so you'll either have to not use enzyme, or downgrade to a RN version that works with React 15.

Hey there, and thanks a ton for Enzyme! Awesome tool!

Say, I'm running Enzyme 2.8.2 with Chai-Enzyme 0.7.1, on React 15.6, through Jest 20.0.4. Just by requiring enzyme I still get a warning on console.error :

Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.

Stripping enzyme removes the warning. So I'm unsure what gives: this issue seems to say this is addressed. Wut?

Does the same thing happen if you omit chai-enzyme?

If so, please file a new issue and we'll debug there :-)

Yes, it's specific to enzyme. Not loading chai-enzyme still triggers this.

I'll try and put together a minimal reproducible use-case as a public repo and link to it from a fresh issue here.

I've been chasing this problem for a few days too.

Found something that works today; removed react-addons-test-utils, which then caused enzyme to start throwing the error linked in https://github.com/airbnb/enzyme/blob/master/src/react-compat.js#L115 about needing react-test-renderer. Installing that then removed the console errors from my test runs.

Sorry, that's probably not much help, but it's all the detail I have.

@swachtma that didn't help.

So, the issue comes from the explicit dependency in order to support older versions of react.

Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.

Was this page helpful?
0 / 5 - 0 ratings