swsnu / swppfall2021

Learning Software Engineering By Building Web Services
28 stars 19 forks source link

[hw3] should we use enzyme-adapter-react-16? #96

Open zz-zye opened 3 years ago

zz-zye commented 3 years ago

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.

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 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?

kdh0102 commented 3 years ago

Yes, you can change the package.json to use enzyme-adapter-react-17-updated.