See the issue and the test case with original fix in https://github.com/facebook/react/pull/14802.

We'll need to fix it properly, see https://github.com/facebook/react/pull/14802#issuecomment-463277621.
shallowRenderer.render(<Foo foo={1} bar={1} />);
    expect(renderCount).toBe(1);
    
    shallowRenderer.render(<Foo foo={1} bar={2} />);
    expect(renderCount).toBe(1);
    shallowRenderer.render(<Foo foo={2} bar={2} />);
    expect(renderCount).toBe(2);
  });
  it('should not call the comparison function with React.memo on the initial render', () => {
    const areEqual = jest.fn(() => false);
    const SomeComponent = React.memo(({foo}) => {
      return <div>{foo}</div>;
    }, areEqual);
    const shallowRenderer = createRenderer();
    shallowRenderer.render(<SomeComponent foo={1} />);
    expect(areEqual).not.toHaveBeenCalled();
    expect(shallowRenderer.getRenderOutput()).toEqual(<div>{1}</div>);
  });
  it('should handle memo(forwardRef())', () => {
    const testRef = React.createRef();
    const SomeComponent = React.forwardRef((props, ref) => {
      expect(ref).toEqual(testRef);
      return (
        <div>
          <span className="child1" />
          <span className="child2" />
        </div>
      );
    });
    const SomeMemoComponent = React.memo(SomeComponent);