I have set up jest and enzyme and can't get it to run. It complains about the EnzymeAdapter base class.
I have tried configure({})
and Enzyme.configure({})
with the different imports belonging to them, and new Adapter()
and new EnzymeAdapter()
setupTests.js:
import Enzyme, { configure } from 'enzyme';
import EnzymeAdapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new EnzymeAdapter() });
The error i get for each test class is the following:
Enzyme Internal Error: configured enzyme adapter did not inherit from the EnzymeAdapter base class
2 | import EnzymeAdapter from 'enzyme-adapter-react-16';
3 |
> 4 | Enzyme.configure({ adapter: new EnzymeAdapter() });
| ^
at validateAdapter (node_modules/enzyme/src/validateAdapter.js:43:11)
at Object.merge [as configure] (node_modules/enzyme/src/configuration.js:11:5)
at Object.configure (src/setupTests.js:4:8)
at Array.forEach (<anonymous>)
Since I get it for every test suite the setupTests.js works.
The same error appears if I do the configure in the test.js itself
I've been searching for hours with no luck. Has anybody encountered the issue before or have a solution?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire