remove OSS testing builds (#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)
This commit is contained in:
Sunil Pai 2020-02-26 13:12:55 +00:00 committed by GitHub
parent 8e13e770e3
commit d28bd2994b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 46 deletions

View File

@ -8,24 +8,21 @@
*/ */
let React; let React;
let ReactDOM; let DOMAct;
let TestRenderer; let TestRenderer;
let TestAct;
global.__DEV__ = process.env.NODE_ENV !== 'production'; global.__DEV__ = process.env.NODE_ENV !== 'production';
jest.mock('react-dom', () =>
require.requireActual('react-dom/cjs/react-dom-testing.development.js')
);
// we'll replace the above with react/testing and react-dom/testing right before the next minor
expect.extend(require('../toWarnDev')); expect.extend(require('../toWarnDev'));
describe('unmocked scheduler', () => { describe('unmocked scheduler', () => {
beforeEach(() => { beforeEach(() => {
jest.resetModules(); jest.resetModules();
React = require('react'); React = require('react');
ReactDOM = require('react-dom'); DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer'); TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
}); });
it('flushes work only outside the outermost act() corresponding to its own renderer', () => { it('flushes work only outside the outermost act() corresponding to its own renderer', () => {
@ -37,8 +34,8 @@ describe('unmocked scheduler', () => {
return null; return null;
} }
// in legacy mode, this tests whether an act only flushes its own effects // in legacy mode, this tests whether an act only flushes its own effects
TestRenderer.act(() => { TestAct(() => {
ReactDOM.act(() => { DOMAct(() => {
TestRenderer.create(<Effecty />); TestRenderer.create(<Effecty />);
}); });
expect(log).toEqual([]); expect(log).toEqual([]);
@ -47,8 +44,8 @@ describe('unmocked scheduler', () => {
log = []; log = [];
// for doublechecking, we flip it inside out, and assert on the outermost // for doublechecking, we flip it inside out, and assert on the outermost
ReactDOM.act(() => { DOMAct(() => {
TestRenderer.act(() => { TestAct(() => {
TestRenderer.create(<Effecty />); TestRenderer.create(<Effecty />);
}); });
expect(log).toEqual(['called']); expect(log).toEqual(['called']);
@ -64,8 +61,9 @@ describe('mocked scheduler', () => {
require.requireActual('scheduler/unstable_mock') require.requireActual('scheduler/unstable_mock')
); );
React = require('react'); React = require('react');
ReactDOM = require('react-dom'); DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer'); TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
}); });
afterEach(() => { afterEach(() => {
@ -81,8 +79,8 @@ describe('mocked scheduler', () => {
return null; return null;
} }
// with a mocked scheduler, this tests whether it flushes all work only on the outermost act // with a mocked scheduler, this tests whether it flushes all work only on the outermost act
TestRenderer.act(() => { TestAct(() => {
ReactDOM.act(() => { DOMAct(() => {
TestRenderer.create(<Effecty />); TestRenderer.create(<Effecty />);
}); });
expect(log).toEqual([]); expect(log).toEqual([]);
@ -91,8 +89,8 @@ describe('mocked scheduler', () => {
log = []; log = [];
// for doublechecking, we flip it inside out, and assert on the outermost // for doublechecking, we flip it inside out, and assert on the outermost
ReactDOM.act(() => { DOMAct(() => {
TestRenderer.act(() => { TestAct(() => {
TestRenderer.create(<Effecty />); TestRenderer.create(<Effecty />);
}); });
expect(log).toEqual([]); expect(log).toEqual([]);

View File

@ -10,6 +10,7 @@
let React; let React;
let ReactDOM; let ReactDOM;
let ReactART; let ReactART;
let TestUtils;
let ARTSVGMode; let ARTSVGMode;
let ARTCurrentMode; let ARTCurrentMode;
let TestRenderer; let TestRenderer;
@ -18,11 +19,6 @@ let ARTTest;
global.__DEV__ = process.env.NODE_ENV !== 'production'; global.__DEV__ = process.env.NODE_ENV !== 'production';
global.__EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental'; global.__EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental';
jest.mock('react-dom', () =>
require.requireActual('react-dom/cjs/react-dom-testing.development.js')
);
// we'll replace the above with react/testing and react-dom/testing right before the next minor
expect.extend(require('../toWarnDev')); expect.extend(require('../toWarnDev'));
function App(props) { function App(props) {
@ -33,6 +29,7 @@ beforeEach(() => {
jest.resetModules(); jest.resetModules();
React = require('react'); React = require('react');
ReactDOM = require('react-dom'); ReactDOM = require('react-dom');
TestUtils = require('react-dom/test-utils');
ReactART = require('react-art'); ReactART = require('react-art');
ARTSVGMode = require('art/modes/svg'); ARTSVGMode = require('art/modes/svg');
ARTCurrentMode = require('art/modes/current'); ARTCurrentMode = require('art/modes/current');
@ -73,7 +70,7 @@ beforeEach(() => {
}); });
it("doesn't warn when you use the right act + renderer: dom", () => { it("doesn't warn when you use the right act + renderer: dom", () => {
ReactDOM.act(() => { TestUtils.act(() => {
ReactDOM.render(<App />, document.createElement('div')); ReactDOM.render(<App />, document.createElement('div'));
}); });
}); });
@ -89,7 +86,7 @@ it('resets correctly across renderers', () => {
React.useEffect(() => {}, []); React.useEffect(() => {}, []);
return null; return null;
} }
ReactDOM.act(() => { TestUtils.act(() => {
TestRenderer.act(() => {}); TestRenderer.act(() => {});
expect(() => { expect(() => {
TestRenderer.create(<Effecty />); TestRenderer.create(<Effecty />);
@ -126,7 +123,7 @@ it('warns when using the wrong act version - test + dom: updates', () => {
it('warns when using the wrong act version - dom + test: .create()', () => { it('warns when using the wrong act version - dom + test: .create()', () => {
expect(() => { expect(() => {
ReactDOM.act(() => { TestUtils.act(() => {
TestRenderer.create(<App />); TestRenderer.create(<App />);
}); });
}).toWarnDev(["It looks like you're using the wrong act()"], { }).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()', () => {
it('warns when using the wrong act version - dom + test: .update()', () => { it('warns when using the wrong act version - dom + test: .update()', () => {
const root = TestRenderer.create(<App key="one" />); const root = TestRenderer.create(<App key="one" />);
expect(() => { expect(() => {
ReactDOM.act(() => { TestUtils.act(() => {
root.update(<App key="two" />); root.update(<App key="two" />);
}); });
}).toWarnDev(["It looks like you're using the wrong act()"], { }).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', () => {
} }
TestRenderer.create(<Counter />); TestRenderer.create(<Counter />);
expect(() => { expect(() => {
ReactDOM.act(() => { TestUtils.act(() => {
setCtr(1); setCtr(1);
}); });
}).toWarnDev(["It looks like you're using the wrong act()"]); }).toWarnDev(["It looks like you're using the wrong act()"]);
}); });
it('does not warn when nesting react-act inside react-dom', () => { it('does not warn when nesting react-act inside react-dom', () => {
ReactDOM.act(() => { TestUtils.act(() => {
ReactDOM.render(<ARTTest />, document.createElement('div')); ReactDOM.render(<ARTTest />, document.createElement('div'));
}); });
}); });
@ -174,7 +171,7 @@ it('does not warn when nesting react-act inside react-test-renderer', () => {
it("doesn't warn if you use nested acts from different renderers", () => { it("doesn't warn if you use nested acts from different renderers", () => {
TestRenderer.act(() => { TestRenderer.act(() => {
ReactDOM.act(() => { TestUtils.act(() => {
TestRenderer.create(<App />); TestRenderer.create(<App />);
}); });
}); });

View File

@ -104,22 +104,6 @@ const bundles = [
externals: ['react', 'react-dom'], externals: ['react', 'react-dom'],
}, },
/******* React DOM - Testing *******/
{
moduleType: RENDERER,
bundleTypes: [
UMD_DEV,
UMD_PROD,
UMD_PROFILING,
NODE_DEV,
NODE_PROD,
NODE_PROFILING,
],
entry: 'react-dom/testing',
global: 'ReactDOM',
externals: ['react'],
},
/******* React DOM - www - Testing *******/ /******* React DOM - www - Testing *******/
{ {
moduleType: RENDERER, moduleType: RENDERER,

View File

@ -46,7 +46,7 @@ const forks = Object.freeze({
// Without this fork, importing `shared/ReactSharedInternals` inside // Without this fork, importing `shared/ReactSharedInternals` inside
// the `react` package itself would not work due to a cyclical dependency. // the `react` package itself would not work due to a cyclical dependency.
'shared/ReactSharedInternals': (bundleType, entry, dependencies) => { 'shared/ReactSharedInternals': (bundleType, entry, dependencies) => {
if (entry === 'react' || entry === 'react/testing') { if (entry === 'react') {
return 'react/src/ReactSharedInternals'; return 'react/src/ReactSharedInternals';
} }
if (dependencies.indexOf('react') === -1) { if (dependencies.indexOf('react') === -1) {
@ -107,7 +107,6 @@ const forks = Object.freeze({
} }
return 'shared/forks/ReactFeatureFlags.test-renderer.js'; return 'shared/forks/ReactFeatureFlags.test-renderer.js';
case 'react-dom/testing': case 'react-dom/testing':
case 'react/testing':
switch (bundleType) { switch (bundleType) {
case FB_WWW_DEV: case FB_WWW_DEV:
case FB_WWW_PROD: case FB_WWW_PROD: