简体   繁体   中英

TypeError: Cannot read property 'create' of undefined (Material UI/enzyme)

What I get when I mount a component, (with shallow I dont get this error) I get the following error.

TypeError: Cannot read property 'create' of undefined
at stylesOrCreator (node_modules/@material-ui/core/CircularProgress/CircularProgress.js
.
.
.

get also this error on top:
node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js Uncaught TypeError: Cannot read property 'body2' of undefined

Versions from package.json:
enzyme version: 3.10.0
react version: 16.11.0
react-dom version: 16.11.0
react-test-renderer version: 16.11.1
enzyme-adapter-react-16 version: 1.11.2

I needed to wrap the tested component with the material UI theme provider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM