Skip to content

Commit d28bd29

Browse files
remove OSS testing builds (facebook#18138)
The testing build versions of react-dom are included in the builds right now, but we're not ready to share them yet. This PR removes them for now (back soon for the next release)
1 parent 8e13e77 commit d28bd29

File tree

4 files changed

+24
-46
lines changed

4 files changed

+24
-46
lines changed

fixtures/dom/src/__tests__/nested-act-test.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@
88
*/
99

1010
let React;
11-
let ReactDOM;
11+
let DOMAct;
1212
let TestRenderer;
13+
let TestAct;
1314

1415
global.__DEV__ = process.env.NODE_ENV !== 'production';
1516

16-
jest.mock('react-dom', () =>
17-
require.requireActual('react-dom/cjs/react-dom-testing.development.js')
18-
);
19-
// we'll replace the above with react/testing and react-dom/testing right before the next minor
20-
2117
expect.extend(require('../toWarnDev'));
2218

2319
describe('unmocked scheduler', () => {
2420
beforeEach(() => {
2521
jest.resetModules();
2622
React = require('react');
27-
ReactDOM = require('react-dom');
23+
DOMAct = require('react-dom/test-utils').act;
2824
TestRenderer = require('react-test-renderer');
25+
TestAct = TestRenderer.act;
2926
});
3027

3128
it('flushes work only outside the outermost act() corresponding to its own renderer', () => {
@@ -37,8 +34,8 @@ describe('unmocked scheduler', () => {
3734
return null;
3835
}
3936
// in legacy mode, this tests whether an act only flushes its own effects
40-
TestRenderer.act(() => {
41-
ReactDOM.act(() => {
37+
TestAct(() => {
38+
DOMAct(() => {
4239
TestRenderer.create(<Effecty />);
4340
});
4441
expect(log).toEqual([]);
@@ -47,8 +44,8 @@ describe('unmocked scheduler', () => {
4744

4845
log = [];
4946
// for doublechecking, we flip it inside out, and assert on the outermost
50-
ReactDOM.act(() => {
51-
TestRenderer.act(() => {
47+
DOMAct(() => {
48+
TestAct(() => {
5249
TestRenderer.create(<Effecty />);
5350
});
5451
expect(log).toEqual(['called']);
@@ -64,8 +61,9 @@ describe('mocked scheduler', () => {
6461
require.requireActual('scheduler/unstable_mock')
6562
);
6663
React = require('react');
67-
ReactDOM = require('react-dom');
64+
DOMAct = require('react-dom/test-utils').act;
6865
TestRenderer = require('react-test-renderer');
66+
TestAct = TestRenderer.act;
6967
});
7068

7169
afterEach(() => {
@@ -81,8 +79,8 @@ describe('mocked scheduler', () => {
8179
return null;
8280
}
8381
// with a mocked scheduler, this tests whether it flushes all work only on the outermost act
84-
TestRenderer.act(() => {
85-
ReactDOM.act(() => {
82+
TestAct(() => {
83+
DOMAct(() => {
8684
TestRenderer.create(<Effecty />);
8785
});
8886
expect(log).toEqual([]);
@@ -91,8 +89,8 @@ describe('mocked scheduler', () => {
9189

9290
log = [];
9391
// for doublechecking, we flip it inside out, and assert on the outermost
94-
ReactDOM.act(() => {
95-
TestRenderer.act(() => {
92+
DOMAct(() => {
93+
TestAct(() => {
9694
TestRenderer.create(<Effecty />);
9795
});
9896
expect(log).toEqual([]);

fixtures/dom/src/__tests__/wrong-act-test.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
let React;
1111
let ReactDOM;
1212
let ReactART;
13+
let TestUtils;
1314
let ARTSVGMode;
1415
let ARTCurrentMode;
1516
let TestRenderer;
@@ -18,11 +19,6 @@ let ARTTest;
1819
global.__DEV__ = process.env.NODE_ENV !== 'production';
1920
global.__EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental';
2021

21-
jest.mock('react-dom', () =>
22-
require.requireActual('react-dom/cjs/react-dom-testing.development.js')
23-
);
24-
// we'll replace the above with react/testing and react-dom/testing right before the next minor
25-
2622
expect.extend(require('../toWarnDev'));
2723

2824
function App(props) {
@@ -33,6 +29,7 @@ beforeEach(() => {
3329
jest.resetModules();
3430
React = require('react');
3531
ReactDOM = require('react-dom');
32+
TestUtils = require('react-dom/test-utils');
3633
ReactART = require('react-art');
3734
ARTSVGMode = require('art/modes/svg');
3835
ARTCurrentMode = require('art/modes/current');
@@ -73,7 +70,7 @@ beforeEach(() => {
7370
});
7471

7572
it("doesn't warn when you use the right act + renderer: dom", () => {
76-
ReactDOM.act(() => {
73+
TestUtils.act(() => {
7774
ReactDOM.render(<App />, document.createElement('div'));
7875
});
7976
});
@@ -89,7 +86,7 @@ it('resets correctly across renderers', () => {
8986
React.useEffect(() => {}, []);
9087
return null;
9188
}
92-
ReactDOM.act(() => {
89+
TestUtils.act(() => {
9390
TestRenderer.act(() => {});
9491
expect(() => {
9592
TestRenderer.create(<Effecty />);
@@ -126,7 +123,7 @@ it('warns when using the wrong act version - test + dom: updates', () => {
126123

127124
it('warns when using the wrong act version - dom + test: .create()', () => {
128125
expect(() => {
129-
ReactDOM.act(() => {
126+
TestUtils.act(() => {
130127
TestRenderer.create(<App />);
131128
});
132129
}).toWarnDev(["It looks like you're using the wrong act()"], {
@@ -137,7 +134,7 @@ it('warns when using the wrong act version - dom + test: .create()', () => {
137134
it('warns when using the wrong act version - dom + test: .update()', () => {
138135
const root = TestRenderer.create(<App key="one" />);
139136
expect(() => {
140-
ReactDOM.act(() => {
137+
TestUtils.act(() => {
141138
root.update(<App key="two" />);
142139
});
143140
}).toWarnDev(["It looks like you're using the wrong act()"], {
@@ -154,14 +151,14 @@ it('warns when using the wrong act version - dom + test: updates', () => {
154151
}
155152
TestRenderer.create(<Counter />);
156153
expect(() => {
157-
ReactDOM.act(() => {
154+
TestUtils.act(() => {
158155
setCtr(1);
159156
});
160157
}).toWarnDev(["It looks like you're using the wrong act()"]);
161158
});
162159

163160
it('does not warn when nesting react-act inside react-dom', () => {
164-
ReactDOM.act(() => {
161+
TestUtils.act(() => {
165162
ReactDOM.render(<ARTTest />, document.createElement('div'));
166163
});
167164
});
@@ -174,7 +171,7 @@ it('does not warn when nesting react-act inside react-test-renderer', () => {
174171

175172
it("doesn't warn if you use nested acts from different renderers", () => {
176173
TestRenderer.act(() => {
177-
ReactDOM.act(() => {
174+
TestUtils.act(() => {
178175
TestRenderer.create(<App />);
179176
});
180177
});

scripts/rollup/bundles.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,6 @@ const bundles = [
104104
externals: ['react', 'react-dom'],
105105
},
106106

107-
/******* React DOM - Testing *******/
108-
{
109-
moduleType: RENDERER,
110-
bundleTypes: [
111-
UMD_DEV,
112-
UMD_PROD,
113-
UMD_PROFILING,
114-
NODE_DEV,
115-
NODE_PROD,
116-
NODE_PROFILING,
117-
],
118-
entry: 'react-dom/testing',
119-
global: 'ReactDOM',
120-
externals: ['react'],
121-
},
122-
123107
/******* React DOM - www - Testing *******/
124108
{
125109
moduleType: RENDERER,

scripts/rollup/forks.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const forks = Object.freeze({
4646
// Without this fork, importing `shared/ReactSharedInternals` inside
4747
// the `react` package itself would not work due to a cyclical dependency.
4848
'shared/ReactSharedInternals': (bundleType, entry, dependencies) => {
49-
if (entry === 'react' || entry === 'react/testing') {
49+
if (entry === 'react') {
5050
return 'react/src/ReactSharedInternals';
5151
}
5252
if (dependencies.indexOf('react') === -1) {
@@ -107,7 +107,6 @@ const forks = Object.freeze({
107107
}
108108
return 'shared/forks/ReactFeatureFlags.test-renderer.js';
109109
case 'react-dom/testing':
110-
case 'react/testing':
111110
switch (bundleType) {
112111
case FB_WWW_DEV:
113112
case FB_WWW_PROD:

0 commit comments

Comments
 (0)