I have upgraded react from 17.0.2 to 18.2.0. I have also added enzyme adapter: https://github.com/cfaester/enzyme-adapter-react-18. However, the mount function in enzyme is throwing the error: TypeError: Cannot read property '_reactInternals' of null. The error is thrown whether I pass a component to mount function as:
import { mount } from 'enzyme';
component = mount(
<SomeComponent> </SomeComponent>
);
or some html as:
import { mount } from 'enzyme';
component = mount(
<div>...</div>
);
In setupTests.js file, I have used the adapter as:
import { configure } from 'enzyme';
import Adapter from '@cfaester/enzyme-adapter-react-18';
configure({ adapter: new Adapter() });
Could anyone tell me how I can solve this issue?