Skip to content

Delete test-utils implementation of act#21703

Merged
acdlite merged 2 commits into
react:masterfrom
acdlite:delete-test-utils-act
Jun 22, 2021
Merged

Delete test-utils implementation of act#21703
acdlite merged 2 commits into
react:masterfrom
acdlite:delete-test-utils-act

Conversation

@acdlite

@acdlite acdlite commented Jun 18, 2021

Copy link
Copy Markdown
Collaborator

Since it's dev-only now, we can use the one provided by the reconciler.

Since it's dev-only now, we can use the one provided by the reconciler.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jun 18, 2021
@sizebot

sizebot commented Jun 18, 2021

Copy link
Copy Markdown

Comparing: 568dc35...b5debd5

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 +0.04% 127.34 kB 127.40 kB +0.06% 40.82 kB 40.85 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.04% 130.16 kB 130.21 kB +0.06% 41.73 kB 41.75 kB
facebook-www/ReactDOM-prod.classic.js +0.02% 405.68 kB 405.75 kB +0.03% 75.00 kB 75.02 kB
facebook-www/ReactDOM-prod.modern.js +0.02% 394.11 kB 394.18 kB +0.04% 73.23 kB 73.26 kB
facebook-www/ReactDOMForked-prod.classic.js +0.02% 405.68 kB 405.75 kB +0.03% 75.00 kB 75.03 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-stable/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
facebook-www/ReactTestUtils-dev.classic.js = 62.86 kB 56.81 kB = 17.28 kB 15.96 kB
facebook-www/ReactTestUtils-dev.modern.js = 62.86 kB 56.80 kB = 17.29 kB 15.96 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-dom/umd/react-dom.development.js +0.61% 1,005.04 kB 1,011.17 kB +0.74% 218.54 kB 220.16 kB
oss-stable/react-dom/umd/react-dom.development.js +0.61% 1,005.04 kB 1,011.17 kB +0.74% 218.54 kB 220.16 kB
oss-stable-semver/react-dom/cjs/react-dom.development.js +0.61% 956.99 kB 962.81 kB +0.75% 215.75 kB 217.36 kB
oss-stable/react-dom/cjs/react-dom.development.js +0.61% 956.99 kB 962.81 kB +0.75% 215.75 kB 217.36 kB
facebook-www/ReactDOMForked-dev.modern.js +0.60% 1,036.72 kB 1,042.97 kB +0.73% 230.43 kB 232.11 kB
facebook-www/ReactDOM-dev.modern.js +0.60% 1,036.72 kB 1,042.97 kB +0.73% 230.43 kB 232.11 kB
oss-experimental/react-dom/umd/react-dom.development.js +0.59% 1,030.94 kB 1,037.07 kB +0.72% 223.60 kB 225.22 kB
oss-experimental/react-dom/cjs/react-dom.development.js +0.59% 981.42 kB 987.24 kB +0.72% 220.86 kB 222.46 kB
facebook-www/ReactDOMForked-dev.classic.js +0.59% 1,061.76 kB 1,068.00 kB +0.71% 235.44 kB 237.12 kB
facebook-www/ReactDOM-dev.classic.js +0.59% 1,061.76 kB 1,068.00 kB +0.71% 235.44 kB 237.12 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-stable/react-dom/umd/react-dom-test-utils.development.js = 73.08 kB 67.13 kB = 19.78 kB 18.54 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js = 67.77 kB 62.08 kB = 19.26 kB 18.04 kB
facebook-www/ReactTestUtils-dev.classic.js = 62.86 kB 56.81 kB = 17.28 kB 15.96 kB
facebook-www/ReactTestUtils-dev.modern.js = 62.86 kB 56.80 kB = 17.29 kB 15.96 kB

Generated by 🚫 dangerJS against b5debd5

Comment thread packages/react-dom/src/test-utils/ReactTestUtils.js Outdated

@rickhanlonii rickhanlonii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, pair reviewed offline online

@acdlite
acdlite merged commit 422e0bb into react:master Jun 22, 2021
facebook-github-bot pushed a commit to facebookexperimental/Recoil that referenced this pull request Jun 27, 2021
Summary:
Includes a re-implementation of the `act` testing API to decouple it from the mock Scheduler module.

Because our Jest configuration mocks the Scheduler for all tests in www, some tests had become accidentally coupled to it. I had to update ~60 test files.

The most common pattern I found was people calling `act()` with a no-op function, which had the effect of flushing all pending work. This no longer works in the new implementation. (We will eventually provide a way to opt into Scheduler mocking for advanced cases, but it probably won't be the default.)

The fix was usually to wrap an earlier update in `act` to ensure that all its work is fully flushed.

 ---

This sync includes the following changes:
- **[27c9c95e2](react/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](react/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](react/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](react/react#21734)) //<Dan Abramov>//
- **[355591add](react/react@355591add)**: Next/experimental release versions include commit date ([#21700](react/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](react/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](react/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](react/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](react/react#21714)) //<Andrew Clark>//
- **[422e0bb36](react/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](react/react#21703)) //<Andrew Clark>//

Reviewed By: rickhanlonii

Differential Revision: D29314763

fbshipit-source-id: 6c53a053e00defee0ab89f30e2f6bd2a1ff29bce
AlexGuz23 pushed a commit to AlexGuz23/Recoil that referenced this pull request Nov 3, 2022
Summary:
Includes a re-implementation of the `act` testing API to decouple it from the mock Scheduler module.

Because our Jest configuration mocks the Scheduler for all tests in www, some tests had become accidentally coupled to it. I had to update ~60 test files.

The most common pattern I found was people calling `act()` with a no-op function, which had the effect of flushing all pending work. This no longer works in the new implementation. (We will eventually provide a way to opt into Scheduler mocking for advanced cases, but it probably won't be the default.)

The fix was usually to wrap an earlier update in `act` to ensure that all its work is fully flushed.

 ---

This sync includes the following changes:
- **[27c9c95e2](react/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](react/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](react/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](react/react#21734)) //<Dan Abramov>//
- **[355591add](react/react@355591add)**: Next/experimental release versions include commit date ([#21700](react/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](react/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](react/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](react/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](react/react#21714)) //<Andrew Clark>//
- **[422e0bb36](react/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](react/react#21703)) //<Andrew Clark>//

Reviewed By: rickhanlonii

Differential Revision: D29314763

fbshipit-source-id: 6c53a053e00defee0ab89f30e2f6bd2a1ff29bce
snipershooter0701 pushed a commit to snipershooter0701/Recoil that referenced this pull request Mar 5, 2023
Summary:
Includes a re-implementation of the `act` testing API to decouple it from the mock Scheduler module.

Because our Jest configuration mocks the Scheduler for all tests in www, some tests had become accidentally coupled to it. I had to update ~60 test files.

The most common pattern I found was people calling `act()` with a no-op function, which had the effect of flushing all pending work. This no longer works in the new implementation. (We will eventually provide a way to opt into Scheduler mocking for advanced cases, but it probably won't be the default.)

The fix was usually to wrap an earlier update in `act` to ensure that all its work is fully flushed.

 ---

This sync includes the following changes:
- **[27c9c95e2](react/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](react/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](react/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](react/react#21734)) //<Dan Abramov>//
- **[355591add](react/react@355591add)**: Next/experimental release versions include commit date ([#21700](react/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](react/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](react/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](react/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](react/react#21714)) //<Andrew Clark>//
- **[422e0bb36](react/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](react/react#21703)) //<Andrew Clark>//

Reviewed By: rickhanlonii

Differential Revision: D29314763

fbshipit-source-id: 6c53a053e00defee0ab89f30e2f6bd2a1ff29bce
eagle2722 added a commit to eagle2722/Recoil that referenced this pull request Sep 21, 2024
Summary:
Includes a re-implementation of the `act` testing API to decouple it from the mock Scheduler module.

Because our Jest configuration mocks the Scheduler for all tests in www, some tests had become accidentally coupled to it. I had to update ~60 test files.

The most common pattern I found was people calling `act()` with a no-op function, which had the effect of flushing all pending work. This no longer works in the new implementation. (We will eventually provide a way to opt into Scheduler mocking for advanced cases, but it probably won't be the default.)

The fix was usually to wrap an earlier update in `act` to ensure that all its work is fully flushed.

 ---

This sync includes the following changes:
- **[27c9c95e2](react/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](react/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](react/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](react/react#21734)) //<Dan Abramov>//
- **[355591add](react/react@355591add)**: Next/experimental release versions include commit date ([#21700](react/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](react/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](react/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](react/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](react/react#21714)) //<Andrew Clark>//
- **[422e0bb36](react/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](react/react#21703)) //<Andrew Clark>//

Reviewed By: rickhanlonii

Differential Revision: D29314763

fbshipit-source-id: 6c53a053e00defee0ab89f30e2f6bd2a1ff29bce
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
* Delete test-utils implementation of `act`

Since it's dev-only now, we can use the one provided by the reconciler.

* Move act related stuff out of EventInternals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants