mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Remove unnecessary error overriding in (#19949)
This commit is contained in:
@@ -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 ' +
|
||||
|
||||
Reference in New Issue
Block a user