superplate's plugin of Enzyme is built on top of superplate's Jest plugin and automatically includes necessary wrappers and imports to run your component tests.
You can see how superplate's Enzyme plugin is implemented below.
Configuration for Jest is not included. Please check out Jest Plugin to learn more about our Jest configuration.
Currently, Enzyme is not fully supporting React 17. We will be using @wojtekmaj/enzyme-adapter-react-17 as an adapter for React 17 for compatibility.
We need to configure Enzyme with React 17 Adapter in our
jest.setup.js file. We can do this with following code;
We may need to wrap our test components to context providers, data stores etc. It's a good practice to make this wrappers globally available. We will create a custom mount function in
We will use Jest as our test runner. If Jest is already set up you can simply run
All this work will be handled automatically by superplate, so you don’t need to do anything extra as long as you choose Enzyme as testing plugin during the project creation phase.
If you want to add Enzyme to your existing project first install the dependencies
Then you can follow documentations for detail usage