enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

No explanation what to do with configuration file #2546

Open konrazem opened 3 years ago

konrazem commented 3 years ago

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 😃

ljharb commented 3 years ago

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.

konrazem commented 3 years ago

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

ljharb commented 3 years ago

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

A PR to improve the docs is welcome.

jrachelr commented 1 year ago

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

ljharb commented 1 year ago

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