I ran into a problem where if I use mount() on a component then an error occurs. It says TypeError: Cannot read property 'child' of undefined. After searching, I found that it may occur because the react version 17.0.2 and enzyme-adapter-react-16 conflicts.
In the swpp-unittest-tutorial from the practice session, I found that enzyme-adapter-react-17-updated was used instead of enzyme-adapter-react-16, and there were no problems in using mount(). Can I change my package.json file so that I use enzyme-adapter-react-17-updated?
I ran into a problem where if I use
mount()
on a component then an error occurs. It saysTypeError: Cannot read property 'child' of undefined
. After searching, I found that it may occur because thereact
version 17.0.2 andenzyme-adapter-react-16
conflicts.https://stackoverflow.com/questions/64586111/mount-does-not-work-in-enzyme-with-next-js
In the swpp-unittest-tutorial from the practice session, I found that
enzyme-adapter-react-17-updated
was used instead ofenzyme-adapter-react-16
, and there were no problems in usingmount()
. Can I change my package.json file so that I useenzyme-adapter-react-17-updated
?