GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ReactDOM: Remove every test-util except `act()` by eps1lon · Pull Request #28541 · react/react

Conversation

@eps1lon

@eps1lon eps1lon commented Mar 11, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Summary

Removes every API from react-dom/test-utils except act in favor of using @testing-library/react. Removal is gated behind disableDOMTestUtils that's off for Meta builds.

The functions aren't removed but instead throw with a helpful error message. We're doing the same for ReactDOM.render.

Also reverts #28446 to restore test coverage.

Some APIs like renderIntoDocument are technically gated behind disableDOMTestUtils and disableLegacyRoot. We could just combine both flags to prevent drift.

How did you test this change?

  • yarn test ReactTestUtils-test

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 11, 2024
@react-sizebot

react-sizebot commented Mar 11, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 4cc0f8e...82e3562

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 176.92 kB 176.92 kB = 54.99 kB 54.99 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 173.10 kB 173.10 kB = 53.94 kB 53.94 kB
facebook-www/ReactDOM-prod.classic.js = 592.31 kB 592.31 kB = 103.83 kB 103.83 kB
facebook-www/ReactDOM-prod.modern.js = 573.20 kB 573.20 kB = 100.71 kB 100.71 kB
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js = 12.03 kB 8.73 kB = 4.70 kB 2.75 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js = 11.94 kB 8.59 kB = 4.66 kB 2.67 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.js = 42.64 kB 26.34 kB = 12.10 kB 7.16 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 47.41 kB 28.06 kB = 13.09 kB 7.34 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 44.63 kB 26.38 kB = 12.87 kB 7.19 kB
test_utils/ReactAllWarnings.js Deleted 65.07 kB 0.00 kB Deleted 16.27 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js = 12.03 kB 8.73 kB = 4.70 kB 2.75 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js = 11.94 kB 8.59 kB = 4.66 kB 2.67 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.js = 42.64 kB 26.34 kB = 12.10 kB 7.16 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 47.41 kB 28.06 kB = 13.09 kB 7.34 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 44.63 kB 26.38 kB = 12.87 kB 7.19 kB
test_utils/ReactAllWarnings.js Deleted 65.07 kB 0.00 kB Deleted 16.27 kB 0.00 kB

Generated by 🚫 dangerJS against 82e3562

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon
eps1lon force-pushed the dom/remove-test-utils branch from 5c74ee7 to 5fc850d Compare March 11, 2024 20:14
@jackpope

jackpope commented Mar 12, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

I looked into vendoring ReactTestUtils in WWW to avoiding needing additional gating here but it has too much internal usage for it to be stable.

Can we apply either gating on the utils functions themselves or a build fork of the whole module? And additionally can we keep the ReactTestUtils-test with gating for www? Let me know if you want help with the additional work here.

Ideally within a couple months we can fully remove.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon

eps1lon commented Mar 13, 2024

Copy link
Copy Markdown
Collaborator Author

Can we apply either gating on the utils functions themselves or a build fork of the whole module?

We use special .fb entrypoints on other packages so I hope I can leverage these for test-utils and then just gate the tests behind www.

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon
eps1lon force-pushed the dom/remove-test-utils branch 2 times, most recently from e36702e to f5c3394 Compare March 14, 2024 14:00
@eps1lon

eps1lon commented Mar 14, 2024

Copy link
Copy Markdown
Collaborator Author

Didn't go with the special .fb entrypoint since that implies forking for modern, classic, experimental and stable. I used a simple feature flag instead like we do for ReactDOM.render

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon
eps1lon marked this pull request as ready for review March 14, 2024 14:01
@eps1lon
eps1lon requested review from gnoff and jackpope March 14, 2024 14:01
@eps1lon eps1lon added the React 19 label Mar 14, 2024
@eps1lon eps1lon mentioned this pull request Mar 20, 2024
Deprecate act from react-dom/test-utils in favor of act from react #28597
Merged
@eps1lon
eps1lon force-pushed the dom/remove-test-utils branch 3 times, most recently from 65cf02e to ce7a436 Compare March 23, 2024 21:23
eps1lon
eps1lon commented Mar 23, 2024
View reviewed changes
Comment thread packages/react-dom/src/test-utils/ReactTestUtils.js Outdated
if (disableDOMTestUtils) {
throw new Error(
'`renderIntoDocument` was removed from `react-dom/test-utils`. ' +
'See https://react.dev/warnings/react-test-renderer for more info.',

@eps1lon eps1lon Mar 23, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Write docs

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jackpope jackpope Mar 25, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we generalize this warning page to something like /warnings/testing and include sections for each separate warning between ReactTestUtils and react-test-renderer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rickhanlonii rickhanlonii Mar 25, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably have a page for test-renderer and test-utils

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@eps1lon eps1lon Mar 27, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs: reactjs/react.dev#6716

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
jackpope
jackpope reviewed Mar 25, 2024
View reviewed changes
Comment thread packages/react-dom/src/test-utils/ReactTestUtils.js Outdated
if (disableDOMTestUtils) {
throw new Error(
'`renderIntoDocument` was removed from `react-dom/test-utils`. ' +
'See https://react.dev/warnings/react-test-renderer for more info.',

@jackpope jackpope Mar 25, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we generalize this warning page to something like /warnings/testing and include sections for each separate warning between ReactTestUtils and react-test-renderer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/shared/forks/ReactFeatureFlags.native-fb.js Outdated

export const enableReactTestRendererWarning = false;
export const disableLegacyMode = false;
export const disableDOMTestUtils = true;

@jackpope jackpope Mar 25, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this false for now so this is easier to land.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eps1lon
eps1lon force-pushed the dom/remove-test-utils branch from ce7a436 to 6f3b264 Compare March 27, 2024 11:53
jackpope
jackpope approved these changes Mar 27, 2024
View reviewed changes
eps1lon and others added 3 commits March 27, 2024 15:04
@eps1lon
ReactDOM: Remove every test-util except act()
8c345c2
@eps1lon
Link dedicated warning page
316b39f
@eps1lon
Keep enabled for native
82e3562
@eps1lon
eps1lon force-pushed the dom/remove-test-utils branch from c75f7d6 to 82e3562 Compare March 27, 2024 14:05
@eps1lon eps1lon mentioned this pull request Mar 27, 2024
Add warning page for ReactDOMTestUtils deprecation reactjs/react.dev#6716
Merged
@eps1lon
eps1lon merged commit ec4d26c into react:main Mar 27, 2024
@eps1lon
eps1lon deleted the dom/remove-test-utils branch March 27, 2024 15:12
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@eps1lon @AndyPengc12
ReactDOM: Remove every test-util except act() (react#28541)
f209b57
@eps1lon eps1lon mentioned this pull request Apr 24, 2024
Update React from c3048aab4 to cb151849e1 vercel/next.js#64994
Closed
@eps1lon eps1lon mentioned this pull request Apr 25, 2024
Support React 19 in App and Pages router vercel/next.js#65058
Merged
@fossabot fossabot Bot mentioned this pull request Oct 2, 2025
Bump react and @types/react in /web-app franchb/console#14
Open
@fossabot fossabot Bot mentioned this pull request Oct 20, 2025
chore(deps): bump react and @types/react blinklabs-io/after-town-hall#281
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 31, 2026
feat: add Typography component to DoodleUI: BED-7455 SpecterOps/BloodHound#2577
Merged
4 tasks done
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@eps1lon
ReactDOM: Remove every test-util except act() (react#28541)
bb3da2c
This was referenced Nov 22, 2026
deps: update react to 19.3.1 shadrxcc/porncrit-fe#12
Merged
deps: update react to 19.3.1 linda-ochem/temp#1
Merged
deps: update react to 19.3.1 shadrxcc/lifelineai#4
Merged
deps: update react to 19.3.1 shadrxcc/lifelineai#16
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jackpope jackpope jackpope approved these changes
@gnoff gnoff Awaiting requested review from gnoff
+1 more reviewer
@rickhanlonii rickhanlonii rickhanlonii left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team React 19

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@eps1lon @react-sizebot @jackpope @rickhanlonii @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.