GeezerVison is showing github.com — Remove unnecessary error overriding in (#19949) · react/react@cc77be9
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/shared/__tests__
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/__tests__/ReactErrorProd-test.internal.js -18Lines changed: 0 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
11 | 11 | let formatProdErrorMessage; |
12 | 12 |
|
13 | 13 | describe('ReactErrorProd', () => { |
14 | | - let globalErrorMock; |
15 | | - |
16 | 14 | beforeEach(() => { |
17 | | - if (!__DEV__) { |
18 | | - // In production, our Jest environment overrides the global Error |
19 | | - // class in order to decode error messages automatically. However |
20 | | - // this is a single test where we actually *don't* want to decode |
21 | | - // them. So we assert that the OriginalError exists, and temporarily |
22 | | - // set the global Error object back to it. |
23 | | - globalErrorMock = global.Error; |
24 | | - global.Error = globalErrorMock.OriginalError; |
25 | | - expect(typeof global.Error).toBe('function'); |
26 | | - } |
27 | 15 | jest.resetModules(); |
28 | 16 | formatProdErrorMessage = require('shared/formatProdErrorMessage').default; |
29 | 17 | }); |
30 | 18 |
|
31 | | - afterEach(() => { |
32 | | - if (!__DEV__) { |
33 | | - global.Error = globalErrorMock; |
34 | | - } |
35 | | - }); |
36 | | - |
37 | 19 | it('should throw with the correct number of `%s`s in the URL', () => { |
38 | 20 | expect(formatProdErrorMessage(124, 'foo', 'bar')).toEqual( |
39 | 21 | 'Minified React error #124; visit ' + |
|