Change:
} const shallowRenderer = createRenderer(); <del> expect(() => shallowRenderer.render(<Component />)).toWarnDev( 'Unsafe legacy lifecycles will not be called for components using the new getDerivedStateFromProps() API.', ); }); it('should warn about deprecated lifecycles (cWM/cWRP/cWU) if new static gDSFP is present', () => { let shallowRenderer; class AllLegacyLifecycles extends React.Component { state = {}; static getDerivedStateFromProps() { return null; } componentWillMount() {} UNSAFE_componentWillReceiveProps() {} componentWillUpdate() {} render() { return null; } } shallowRenderer = createRenderer(); expect(() => shallowRenderer.render(<AllLegacyLifecycles />)).toWarnDev( 'Unsafe legacy lifecycles will not be called for components using the new getDerivedStateFromProps() API.nn' + 'AllLegacyLifecycles uses getDerivedStateFromProps() but also contains the following legacy lifecycles:n' + '  componentWillMountn' + '  UNSAFE_componentWillReceivePropsn' + '  componentWillUpdatenn' + 'The above lifecycles should be removed. Learn more about this warning here:n' + 'https://fb.me/react-async-component-lifecycle-hooks', ); class WillMount extends React.Component { state = {}; static getDerivedStateFromProps() { return null; } UNSAFE_componentWillMount() {} render() { return null; } } shallowRenderer = createRenderer(); expect(() => shallowRenderer.render(<WillMount />)).toWarnDev( 'Unsafe legacy lifecycles will not be called for components using the new getDerivedStateFromProps() API.nn' + 'WillMount uses getDerivedStateFromProps() but also contains the following legacy lifecycles:n' + '  UNSAFE_componentWillMountnn' + 'The above lifecycles should be removed. Learn more about this warning here:n' + 'https://fb.me/react-async-component-lifecycle-hooks', ); class WillMountAndUpdate extends React.Component { state = {}; static getDerivedStateFromProps() { return null; } componentWillMount() {} UNSAFE_componentWillUpdate() {} render() { return null; } } shallowRenderer = createRenderer(); expect(() => shallowRenderer.render(<WillMountAndUpdate />)).toWarnDev( 'Unsafe legacy lifecycles will not be called for components using the new getDerivedStateFromProps() API.nn' + 'WillMountAndUpdate uses getDerivedStateFromProps() but also contains the following legacy lifecycles:n' + '  componentWillMountn' + '  UNSAFE_componentWillUpdatenn' + 'The above lifecycles should be removed. Learn more about this warning here:n' + 'https://fb.me/react-async-component-lifecycle-hooks', ); class WillReceiveProps extends React.Component { state = {}; static getDerivedStateFromProps() { return null; } componentWillReceiveProps() {} render() { return null; } } shallowRenderer = createRenderer(); expect(() => shallowRenderer.render(<WillReceiveProps />)).toWarnDev( 'Unsafe legacy lifecycles will not be called for components using the new getDerivedStateFromProps() API.nn' + 'WillReceiveProps uses getDerivedStateFromProps() but also contains the following legacy lifecycles:n' + '  componentWillReceivePropsnn' + 'The above lifecycles should be removed. Learn more about this warning here:n' + 'https://fb.me/react-async-component-lifecycle-hooks', ); </del> <ins> shallowRenderer.render(<Component />); </ins> }); it('should only render 1 level deep', () => {

Discussion:
For consideration. These warnings are already covered by renderers based on react-reconciler. Maybe we don't gain that much by mirroring them in the shallow renderer? Maybe it's not worth the complexity? Particularly with more complicated warnings like the ones being for and .