diff --git a/.circleci/config.yml b/.circleci/config.yml index a978278455218..4e9d85cd8ddde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,8 +107,7 @@ jobs: - run: command: | mkdir -p ./build/__test_utils__ - node ./scripts/print-warnings/print-warnings.js > build/WARNINGS - node ./scripts/print-warnings/print-warnings.js --js > build/__test_utils__/ReactAllWarnings.js + node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js - persist_to_workspace: root: . paths: diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index 2e5007982b1cb..db72ecf2df005 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -119,25 +119,24 @@ jobs: build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js - name: Move relevant files for React in www into compiled run: | - mkdir -p ./compiled - mkdir -p ./compiled/facebook-www - mkdir -p ./compiled/babel-plugin-react-refresh - - # Copy the facebook-www folder into compiled + # Move the facebook-www folder into compiled + mkdir ./compiled mv build/facebook-www ./compiled - # Copy WARNINGS to facebook-www - mv build/WARNINGS ./compiled/facebook-www/WARNINGS + # Move ReactAllWarnings.js to facebook-www + mkdir ./compiled/facebook-www/__test_utils__ + mv build/__test_utils__/ReactAllWarnings.js ./compiled/facebook-www/__test_utils__/ReactAllWarnings.js - # Copy eslint-plugin-react-hooks into facebook-www + # Move eslint-plugin-react-hooks into facebook-www mv build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \ ./compiled/facebook-www/eslint-plugin-react-hooks.js - # Copy unstable_server-external-runtime.js into facebook-www + # Move unstable_server-external-runtime.js into facebook-www mv build/oss-stable/react-dom/unstable_server-external-runtime.js \ ./compiled/facebook-www/unstable_server-external-runtime.js - # Copy react-refresh-babel.development.js into babel-plugin-react-refresh + # Move react-refresh-babel.development.js into babel-plugin-react-refresh + mkdir ./compiled/babel-plugin-react-refresh mv build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js \ ./compiled/babel-plugin-react-refresh/index.js diff --git a/fixtures/dom/src/__tests__/nested-act-test.js b/fixtures/dom/src/__tests__/nested-act-test.js index d57bef7310e41..4a4c63eaad105 100644 --- a/fixtures/dom/src/__tests__/nested-act-test.js +++ b/fixtures/dom/src/__tests__/nested-act-test.js @@ -20,7 +20,7 @@ describe('unmocked scheduler', () => { beforeEach(() => { jest.resetModules(); React = require('react'); - DOMAct = require('react-dom/test-utils').act; + DOMAct = React.unstable_act; TestRenderer = require('react-test-renderer'); TestAct = TestRenderer.act; }); @@ -61,7 +61,7 @@ describe('mocked scheduler', () => { require.requireActual('scheduler/unstable_mock') ); React = require('react'); - DOMAct = require('react-dom/test-utils').act; + DOMAct = React.unstable_act; TestRenderer = require('react-test-renderer'); TestAct = TestRenderer.act; }); diff --git a/packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js b/packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js index 9463b72e14a69..2403d2de286b1 100644 --- a/packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js +++ b/packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js @@ -121,7 +121,7 @@ describe('ReactCache', () => { } ReactTestRenderer.create(, { - unstable_isConcurrent: true, + isConcurrent: true, }); await waitForAll(['Suspend! [Hi]', 'Loading...']); @@ -141,7 +141,7 @@ describe('ReactCache', () => { } const root = ReactTestRenderer.create(, { - unstable_isConcurrent: true, + isConcurrent: true, }); await waitForAll(['Suspend! [Hi]', 'Loading...']); @@ -181,7 +181,7 @@ describe('ReactCache', () => { , { - unstable_isConcurrent: true, + isConcurrent: true, }, ); @@ -210,7 +210,7 @@ describe('ReactCache', () => { , { - unstable_isConcurrent: true, + isConcurrent: true, }, ); await waitForAll(['Suspend! [1]', 'Loading...']); @@ -298,7 +298,7 @@ describe('ReactCache', () => { , { - unstable_isConcurrent: true, + isConcurrent: true, }, ); @@ -356,7 +356,7 @@ describe('ReactCache', () => { , { - unstable_isConcurrent: true, + isConcurrent: true, }, ); @@ -372,7 +372,7 @@ describe('ReactCache', () => { , { - unstable_isConcurrent: true, + isConcurrent: true, }, ); diff --git a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js index 5da6b8de2a42e..eabcbd215bfb2 100644 --- a/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js @@ -254,7 +254,7 @@ describe('React hooks DevTools integration', () => { , - {unstable_isConcurrent: true}, + {isConcurrent: true}, ), ); diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index 891e4f3e73834..cba7b3b2e7b61 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -75,7 +75,7 @@ describe('InspectedElement', () => { // Used by inspectElementAtIndex() helper function utils.act(() => { testRendererInstance = TestRenderer.create(null, { - unstable_isConcurrent: true, + isConcurrent: true, }); }); @@ -307,7 +307,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - unstable_isConcurrent: true, + isConcurrent: true, }); }, ); @@ -469,7 +469,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - unstable_isConcurrent: true, + isConcurrent: true, }); }, ); @@ -2034,7 +2034,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - unstable_isConcurrent: true, + isConcurrent: true, }); }, ); @@ -2317,7 +2317,7 @@ describe('InspectedElement', () => { , - {unstable_isConcurrent: true}, + {isConcurrent: true}, ); }, false); await utils.actAsync(() => { @@ -2817,7 +2817,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - unstable_isConcurrent: true, + isConcurrent: true, }); }, ); diff --git a/packages/react-devtools-shared/src/__tests__/utils.js b/packages/react-devtools-shared/src/__tests__/utils.js index 0c5a0b09f7d01..bf5a8b98eab23 100644 --- a/packages/react-devtools-shared/src/__tests__/utils.js +++ b/packages/react-devtools-shared/src/__tests__/utils.js @@ -19,7 +19,7 @@ export function act( recursivelyFlush: boolean = true, ): void { const {act: actTestRenderer} = require('react-test-renderer'); - const {act: actDOM} = require('react-dom/test-utils'); + const actDOM = require('react').unstable_act; actDOM(() => { actTestRenderer(() => { @@ -44,7 +44,7 @@ export async function actAsync( recursivelyFlush: boolean = true, ): Promise { const {act: actTestRenderer} = require('react-test-renderer'); - const {act: actDOM} = require('react-dom/test-utils'); + const actDOM = require('react').unstable_act; await actDOM(async () => { await actTestRenderer(async () => { diff --git a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js index 3bdcd9c16a966..45de6fa9104f4 100644 --- a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js @@ -25,7 +25,7 @@ describe('ReactDOMServerHydration', () => { React = require('react'); ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); - act = require('react-dom/test-utils').act; + act = React.unstable_act; console.error = jest.fn(); container = document.createElement('div'); diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index be4b59ce0806e..6b8baaddbe023 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -110,7 +110,10 @@ describe('ReactDOMInput', () => { expect(() => { ReactDOM.render(, container); }).toErrorDev( - 'Warning: You provided a `value` prop to a form field without an `onChange` handler.', + 'Warning: You provided a `value` prop to a form ' + + 'field without an `onChange` handler. This will render a read-only ' + + 'field. If the field should be mutable use `defaultValue`. ' + + 'Otherwise, set either `onChange` or `readOnly`.', ); }); @@ -118,7 +121,10 @@ describe('ReactDOMInput', () => { expect(() => { ReactDOM.render(, container); }).toErrorDev( - 'Warning: You provided a `value` prop to a form field without an `onChange` handler.', + 'Warning: You provided a `value` prop to a form ' + + 'field without an `onChange` handler. This will render a read-only ' + + 'field. If the field should be mutable use `defaultValue`. ' + + 'Otherwise, set either `onChange` or `readOnly`.', ); }); @@ -126,7 +132,10 @@ describe('ReactDOMInput', () => { expect(() => { ReactDOM.render(, container); }).toErrorDev( - 'Warning: You provided a `value` prop to a form field without an `onChange` handler.', + 'Warning: You provided a `value` prop to a form ' + + 'field without an `onChange` handler. This will render a read-only ' + + 'field. If the field should be mutable use `defaultValue`. ' + + 'Otherwise, set either `onChange` or `readOnly`.', ); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js index 39a1bac1e9ede..810452c64a313 100644 --- a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js @@ -759,4 +759,85 @@ describe('ReactDOMTextarea', () => { ReactDOM.render(