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.
state = {};
      static getDerivedStateFromProps = logger('getDerivedStateFromProps');
      componentDidMount = logger('componentDidMount');
      shouldComponentUpdate = logger('shouldComponentUpdate');
      componentDidUpdate = logger('componentDidUpdate');
      componentWillUnmount = logger('componentWillUnmount');
      render() {
        return <div />;
      }
    }
    const shallowRenderer = createRenderer();
    shallowRenderer.render(<SomeComponent foo={1} />);
    
    
    expect(logs).toEqual(['getDerivedStateFromProps']);
    logs.splice(0);
    const instance = shallowRenderer.getMountedInstance();
    instance.setState({});
    expect(logs).toEqual(['getDerivedStateFromProps', 'shouldComponentUpdate']);
    logs.splice(0);
    shallowRenderer.render(<SomeComponent foo={2} />);
    
    expect(logs).toEqual(['getDerivedStateFromProps', 'shouldComponentUpdate']);
  });
  it('should not invoke deprecated lifecycles (cWM/cWRP/cWU) if new static gDSFP is present', () => {
    class Component extends React.Component {