Skip to content

Commit

Permalink
remove OSS testing builds (facebook#18138)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
threepointone committed Feb 26, 2020
1 parent 8e13e77 commit d28bd29
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 46 deletions.
30 changes: 14 additions & 16 deletions fixtures/dom/src/__tests__/nested-act-test.js
Expand Up @@ -8,24 +8,21 @@
*/

let React;
let ReactDOM;
let DOMAct;
let TestRenderer;
let TestAct;

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'));

describe('unmocked scheduler', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
});

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

log = [];
// for doublechecking, we flip it inside out, and assert on the outermost
ReactDOM.act(() => {
TestRenderer.act(() => {
DOMAct(() => {
TestAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual(['called']);
Expand All @@ -64,8 +61,9 @@ describe('mocked scheduler', () => {
require.requireActual('scheduler/unstable_mock')
);
React = require('react');
ReactDOM = require('react-dom');
DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
});

afterEach(() => {
Expand All @@ -81,8 +79,8 @@ describe('mocked scheduler', () => {
return null;
}
// with a mocked scheduler, this tests whether it flushes all work only on the outermost act
TestRenderer.act(() => {
ReactDOM.act(() => {
TestAct(() => {
DOMAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual([]);
Expand All @@ -91,8 +89,8 @@ describe('mocked scheduler', () => {

log = [];
// for doublechecking, we flip it inside out, and assert on the outermost
ReactDOM.act(() => {
TestRenderer.act(() => {
DOMAct(() => {
TestAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual([]);
Expand Down
21 changes: 9 additions & 12 deletions fixtures/dom/src/__tests__/wrong-act-test.js
Expand Up @@ -10,6 +10,7 @@
let React;
let ReactDOM;
let ReactART;
let TestUtils;
let ARTSVGMode;
let ARTCurrentMode;
let TestRenderer;
Expand All @@ -18,11 +19,6 @@ let ARTTest;
global.__DEV__ = process.env.NODE_ENV !== 'production';
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'));

function App(props) {
Expand All @@ -33,6 +29,7 @@ beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
TestUtils = require('react-dom/test-utils');
ReactART = require('react-art');
ARTSVGMode = require('art/modes/svg');
ARTCurrentMode = require('art/modes/current');
Expand Down Expand Up @@ -73,7 +70,7 @@ beforeEach(() => {
});

it("doesn't warn when you use the right act + renderer: dom", () => {
ReactDOM.act(() => {
TestUtils.act(() => {
ReactDOM.render(<App />, document.createElement('div'));
});
});
Expand All @@ -89,7 +86,7 @@ it('resets correctly across renderers', () => {
React.useEffect(() => {}, []);
return null;
}
ReactDOM.act(() => {
TestUtils.act(() => {
TestRenderer.act(() => {});
expect(() => {
TestRenderer.create(<Effecty />);
Expand Down Expand Up @@ -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()', () => {
expect(() => {
ReactDOM.act(() => {
TestUtils.act(() => {
TestRenderer.create(<App />);
});
}).toWarnDev(["It looks like you're using the wrong act()"], {
Expand All @@ -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()', () => {
const root = TestRenderer.create(<App key="one" />);
expect(() => {
ReactDOM.act(() => {
TestUtils.act(() => {
root.update(<App key="two" />);
});
}).toWarnDev(["It looks like you're using the wrong act()"], {
Expand All @@ -154,14 +151,14 @@ it('warns when using the wrong act version - dom + test: updates', () => {
}
TestRenderer.create(<Counter />);
expect(() => {
ReactDOM.act(() => {
TestUtils.act(() => {
setCtr(1);
});
}).toWarnDev(["It looks like you're using the wrong act()"]);
});

it('does not warn when nesting react-act inside react-dom', () => {
ReactDOM.act(() => {
TestUtils.act(() => {
ReactDOM.render(<ARTTest />, document.createElement('div'));
});
});
Expand All @@ -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", () => {
TestRenderer.act(() => {
ReactDOM.act(() => {
TestUtils.act(() => {
TestRenderer.create(<App />);
});
});
Expand Down
16 changes: 0 additions & 16 deletions scripts/rollup/bundles.js
Expand Up @@ -104,22 +104,6 @@ const bundles = [
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 *******/
{
moduleType: RENDERER,
Expand Down
3 changes: 1 addition & 2 deletions scripts/rollup/forks.js
Expand Up @@ -46,7 +46,7 @@ const forks = Object.freeze({
// Without this fork, importing `shared/ReactSharedInternals` inside
// the `react` package itself would not work due to a cyclical dependency.
'shared/ReactSharedInternals': (bundleType, entry, dependencies) => {
if (entry === 'react' || entry === 'react/testing') {
if (entry === 'react') {
return 'react/src/ReactSharedInternals';
}
if (dependencies.indexOf('react') === -1) {
Expand Down Expand Up @@ -107,7 +107,6 @@ const forks = Object.freeze({
}
return 'shared/forks/ReactFeatureFlags.test-renderer.js';
case 'react-dom/testing':
case 'react/testing':
switch (bundleType) {
case FB_WWW_DEV:
case FB_WWW_PROD:
Expand Down

0 comments on commit d28bd29

Please sign in to comment.