Skip to content

Commit

Permalink
Remove unnecessary error overriding in (#19949)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoteTheMighty committed Oct 2, 2020
1 parent 9762527 commit cc77be9
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions packages/shared/__tests__/ReactErrorProd-test.internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down

0 comments on commit cc77be9

Please sign in to comment.