'Jest Memory Leak when running test cases on redux connected components

When I run my jest tests, I got the following error , this particularly happens with the redux connected components and forwardRef:true is one parameters of the connect wrapper component

enter image description here

How can I fix my jest configuration to prevent this?



Solution 1:[1]

You may need to do some cleanup in the after hook for each test. You might also consider whether its appropriate to provide a mock for the redux store, so that you are isolating the component tests from the reducer tests.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dave Meehan