DEV Community

Discussion on: The basic form for React component mocks

Collapse
 
hanvyj profile image
hanvyj • Edited

Finally! I had:

beforeEach(() => {
  jest.resetAllMocks();
});
Enter fullscreen mode Exit fullscreen mode

Which if course, was resetting the implementation. I think the issue is react-scripts 4 added "resetMocks": true, as a default so it might be fixed by just:

  "jest": {
    "resetMocks": false,
  }
Enter fullscreen mode Exit fullscreen mode

in your package.json