I have been using Enzyme to test components in a React application for some time. After updating the packages for the first time in several weeks, I started getting an error from my tests.
FAIL src/__tests__/title.test.ts โ Testing title component โบ renders Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none. [...] To find out more about this, see http:
I proceed to install 'enzyme-adapter-react-16' as described in the link and add the following lines to the test file:
import * as enzyme from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; enzyme.configure({ adapter: new Adapter() });
However, since my application is written in TypeScript, I now face two new problems.

To clarify the images, the first TS7016 error is that there are no types for enzyme-adapter-react-16 , and the second TS2339 error says that enzyme does not have a configure property.
I am relatively new to TypeScript, so I need help. I tried to set the types for enzyme-adapter-react-16 , but they don't seem to exist.
Should I try to add them myself, or is there a way to avoid this problem?
It is also interesting how this error appeared. I donโt need an adapter before, why now?
reactjs testing typescript enzyme
langkilde
source share