enzymejs/enzyme

No explanation what to do with configuration file

konrazem opened this issue · 5 comments

It is not a big issue, however, it is a bit frustrating that I can not find in the "Installation" section what is the best way and how to implement configured enzyme instance in my project:

import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });

If you can give an idea how to handle it it would be nice 😃

That entirely depends on your test framework - and that framework's documentation usually would explain how you do a "setup" file for your test suite.

Thanks @ljharb for the fast response. I understand. Even your comment to add to this section I think would be helpful with some examples. Like for create-react-app there is src/setupTests.js file that can do it. There is even issue on stackoverflow

Yes, CRA uses jest, which has its own documentation for how to do a setup file.

A PR to improve the docs is welcome.

@ljharb I can work on this if you want to assign to me

There’s no need for assignment; just make the PR and link it when you’re ready.