jest-react-hooks-shallow
jest-react-hooks-shallow copied to clipboard
Not working correctly with beforeAll
We're currently using this project with both shallow
and mount
renders. In some tests we use beforeAll
with the render function:
const renderComponent = () => {
component = mount(<LinkEditor {...props} />);
};
beforeEach(renderComponent);
The issue here is that beforeAll
is always executed before beforeEach
. And the mocks are setup in a beforeEach
call.
Changing the beforeEach
in the library to beforeAll
fixes this. But this seems not the best solution, as this might break things.
Would it be possible to also add a beforeAll to mock the methods? Or let the user specify which before-method they want to trigger the mocks on?