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.
static contextTypes = {
        foo: PropTypes.string,
      };
      state = {
        bar: 'bar',
      };
      render() {
        return <div>{`${this.context.foo}:${this.state.bar}`}</div>;
      }
    }
    const shallowRenderer = createRenderer();
    let result = shallowRenderer.render(<SimpleComponent />, {
      foo: 'foo',
    });
    expect(result).toEqual(<div>foo:bar</div>);
    const instance = shallowRenderer.getMountedInstance();
    instance.setState({bar: 'baz'});
    result = shallowRenderer.getRenderOutput();
    expect(result).toEqual(<div>foo:baz</div>);
  });
  it('should filter context by contextTypes', () => {
    class SimpleComponent extends React.Component {