return (
      str &&
      str.replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function(m, name) {
        return '\n    in ' + name + ' (at **)';
      })
    );
  }
  it('should not patch console methods that do not receive component stacks', () => {
    expect(fakeConsole.error).not.toBe(mockError);
    expect(fakeConsole.info).toBe(mockInfo);
    expect(fakeConsole.log).toBe(mockLog);
    expect(fakeConsole.warn).not.toBe(mockWarn);
  });
  it('should only patch the console once', () => {
    const {error, warn} = fakeConsole;
    patchConsole({
      appendComponentStack: true,
      breakOnWarn: false,
    });
    expect(fakeConsole.error).toBe(error);
    expect(fakeConsole.warn).toBe(warn);
  });
  it('should un-patch when requested', () => {