/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @emails react-core
 */
'use strict';

let formatProdErrorMessage;

describe('ReactErrorProd', () => {
  let globalErrorMock;

  beforeEach(() => {
    if (!__DEV__) {
      // In production, our Jest environment overrides the global Error
      // class in order to decode error messages automatically. However
      // this is a single test where we actually *don't* want to decode
      // them. So we assert that the OriginalError exists, and temporarily
      // set the global Error object back to it.
      globalErrorMock = global.Error;
      global.Error = globalErrorMock.OriginalError;
      expect(typeof global.Error).toBe('function');
    }
    jest.resetModules();
    formatProdErrorMessage = require('shared/formatProdErrorMessage').default;
  });

  afterEach(() => {
    if (!__DEV__) {
      global.Error = globalErrorMock;
    }
  });

  it('should throw with the correct number of `%s`s in the URL', () => {
    expect(formatProdErrorMessage(124, 'foo', 'bar')).toEqual(
      'Minified React error #124; visit ' +
        'https://reactjs.org/docs/error-decoder.html?invariant=124&args[]=foo&args[]=bar' +
        ' for the full message or use the non-minified dev environment' +
        ' for full errors and additional helpful warnings.',
    );

    expect(formatProdErrorMessage(20)).toEqual(
      'Minified React error #20; visit ' +
        'https://reactjs.org/docs/error-decoder.html?invariant=20' +
        ' for the full message or use the non-minified dev environment' +
        ' for full errors and additional helpful warnings.',
    );

    expect(formatProdErrorMessage(77, '<div>', '&?bar')).toEqual(
      'Minified React error #77; visit ' +
        'https://reactjs.org/docs/error-decoder.html?invariant=77&args[]=%3Cdiv%3E&args[]=%26%3Fbar' +
        ' for the full message or use the non-minified dev environment' +
        ' for full errors and additional helpful warnings.',
    );
  });
});

@@ -292,558 +292,26 @@
 %7B%0A  
-let globalErrorMock;%0A%0A  beforeEach(() =%3E %7B%0A    if (!__DEV__) %7B%0A      // In production, our Jest environment overrides the global Error%0A      // class in order to decode error messages automatically. However%0A      // this is a single test where we actually *don't* want to decode%0A      // them. So we assert that the OriginalError exists, and temporarily%0A      // set the global Error object back to it.%0A      globalErrorMock = global.Error;%0A      global.Error = globalErrorMock.OriginalError;%0A      expect(typeof global.Error).toBe('function');%0A    %7D
+beforeEach(() =%3E %7B
 %0A   
@@ -422,99 +422,8 @@
 );%0A%0A
-  afterEach(() =%3E %7B%0A    if (!__DEV__) %7B%0A      global.Error = globalErrorMock;%0A    %7D%0A  %7D);%0A%0A
   it

Remove unnecessary error overriding in (#19949)