An unofficial React 18 adapter for Enzyme, that you probably shouldn't use.
npm install @cfaester/enzyme-adapter-react-18
A very unofficial adapter for React 18 for Enzyme.
Should you count on it? Probably not. Can you use it as a reference for your own work? Perhaps.
```
npm install --save-dev @cfaester/enzyme-adapter-react-18
You need to add it to Enzyme configuration. This is actually pretty easy. Just import it.
`js
import Enzyme from 'enzyme';
import Adapter from '@cfaester/enzyme-adapter-react-18';
Enzyme.configure({ adapter: new Adapter() });
`
I have personally had a few issues with tests using simulate on a mounted component. Specifically when using form libraries. To alleviate this, wrap your simulate calls in act(), like so:
`js``
await act(() => {
mountWrapper.find('form').simulate('submit');
});
This package can serve as a halfway stop towards migrating your tests to a newer framework like @testing-library/react, or to keep some of your shallow tests working.
I don't have much plan of spending a lot of time maintaining this package. But after some deliberation, I'd rather open source it, than sit on it. If nothing else, it can serve as a reference point for your own implementation.
This couldn't be possible without the work of wojtekmaj, and his React 17 adapter. I think you should consider sponsoring him for his other projects as well.