Remove unnecessary error overriding in (#19949)

This commit is contained in:
Paul Doyle
2020-10-02 22:10:46 +01:00
committed by GitHub
parent 97625272ab
commit cc77be957e
@@ -11,29 +11,11 @@
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 ' +