Enzyme: Warning: React.createFactory() is deprecated and will be removed in a future major release

Created on 28 Feb 2020  路  3Comments  路  Source: enzymejs/enzyme

Current behavior

Hi all, today I updated my react project to v16.13, and now my tests that make use of enzyme helpers, began to give me this warning:

Warning: React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.

Expected behavior

Not showing the warning when using enzyme.

Your environment

Ubuntu 18.04
node v12.16.1 (LTS)
npm v6.13.4 (LTS)

API

  • [X] shallow
  • [X] mount
  • [ ] render

Version

| library | version
| ------------------- | -------
| enzyme | 6.8.0
| react | 16.13.0
| react-dom | 16.13.0

Adapter

  • [X] enzyme-adapter-react-16
  • [ ] enzyme-adapter-react-16.3
  • [ ] enzyme-adapter-react-16.2
  • [ ] enzyme-adapter-react-16.1
  • [ ] enzyme-adapter-react-15
  • [ ] enzyme-adapter-react-15.4
  • [ ] enzyme-adapter-react-14
  • [ ] enzyme-adapter-react-13
  • [ ] enzyme-adapter-react-helper
  • [ ] others ( )
invalid

Most helpful comment

Update, I found the guilty library, it is recompose which is a dependency of @material-ui/core that I am using in my components, so I guess I have to address this issue to material-ui.

All 3 comments

This is confusing - the only part of enzyme that looks at createFactory is inside our own tests, which you wouldn't be exercising.

Is there a stack trace at all? It's possible it's coming in from a dependency we use, or it's coming from an independent enzyme matchers package, or enzyme-to-json, or similar.

The whole stack trace is this:

/node_modules/react/cjs/react.development.js

Sorry, probably it is not enzyme fault, but I search in all of my testing dependencies and the only one that uses React.createFactory is enzyme... You can close this issue if you want.

Update, I found the guilty library, it is recompose which is a dependency of @material-ui/core that I am using in my components, so I guess I have to address this issue to material-ui.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SandroMachado picture SandroMachado  路  3Comments

benadamstyles picture benadamstyles  路  3Comments

aweary picture aweary  路  3Comments

potapovDim picture potapovDim  路  3Comments

heikkimu picture heikkimu  路  3Comments