Skip to content

Commit 6545012

Browse files
authored
Merge pull request #8893 from gaearon/fix-dom-prod-test
Add process.cwd to the test process shim
2 parents 10e5438 + ea9e157 commit 6545012

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

src/isomorphic/classic/types/__tests__/ReactPropTypesProduction-test.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,15 @@
1212
'use strict';
1313

1414
describe('ReactPropTypesProduction', function() {
15-
var oldProcess;
16-
1715
var PropTypes;
1816
var React;
1917
var ReactPropTypeLocations;
2018
var ReactTestUtils;
2119

2220
beforeEach(function() {
2321
__DEV__ = false;
24-
oldProcess = process;
25-
global.process = {
26-
cwd: process.cwd,
27-
env: Object.assign({}, process.env, {NODE_ENV: 'production'}),
28-
};
22+
// eslint-disable-next-line dot-notation
23+
process.env['NODE_ENV'] = 'production';
2924

3025
jest.resetModules();
3126
PropTypes = require('ReactPropTypes');
@@ -36,7 +31,8 @@ describe('ReactPropTypesProduction', function() {
3631

3732
afterEach(function() {
3833
__DEV__ = true;
39-
global.process = oldProcess;
34+
// eslint-disable-next-line dot-notation
35+
process.env['NODE_ENV'] = 'test';
4036
});
4137

4238
function expectThrowsInProduction(declaration, value) {

src/renderers/dom/__tests__/ReactDOMProduction-test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@
1111
'use strict';
1212

1313
describe('ReactDOMProduction', () => {
14-
var oldProcess;
15-
1614
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
1715

1816
var React;
1917
var ReactDOM;
2018

2119
beforeEach(() => {
2220
__DEV__ = false;
23-
oldProcess = process;
24-
global.process = {
25-
env: Object.assign({}, process.env, {NODE_ENV: 'production'}),
26-
};
21+
// eslint-disable-next-line dot-notation
22+
process.env['NODE_ENV'] = 'production';
2723

2824
jest.resetModules();
2925
React = require('React');
@@ -32,7 +28,8 @@ describe('ReactDOMProduction', () => {
3228

3329
afterEach(() => {
3430
__DEV__ = true;
35-
global.process = oldProcess;
31+
// eslint-disable-next-line dot-notation
32+
process.env['NODE_ENV'] = 'test';
3633
});
3734

3835
it('should use prod fbjs', () => {

0 commit comments

Comments
 (0)