Fix process override in ErrorUtils test (#10293)
Dan Abramov committed
Jul 26, 2017 at 20:40 UTC
f3b4aaf388d1a219442aadbc8c6b84c61a0749e9
1 file changed
+6
-1
src/renderers/shared/utils/__tests__/ReactErrorUtils-test.js
+6
-1
@@ -28,10 +28,15 @@ describe('ReactErrorUtils', () => {
28
let oldProcess;
29
beforeEach(() => {
30
__DEV__ = false;
31
+
32
+ // Mutating process.env.NODE_ENV would cause our babel plugins to do the
33
+ // wrong thing. If you change this, make sure to test with jest --no-cache.
34
oldProcess = process;
35
global.process = {
33
- env: Object.assign({}, process.env, {NODE_ENV: 'production'}),
36
+ ...process,
37
+ env: {...process.env, NODE_ENV: 'production'},
38
};
39
+
40
jest.resetModules();
41
ReactErrorUtils = require('ReactErrorUtils');
42
});