Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for invokeGuardedCallback #21734

Merged
merged 5 commits into from
Jun 23, 2021
Merged

Add tests for invokeGuardedCallback #21734

merged 5 commits into from
Jun 23, 2021

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 23, 2021

  • Add render tests
  • Add skipped failing tests for effects
  • Strengthen tests to verify we don't keep rethrowing old errors
  • Port all tests to createRoot too, add TODOs for known mismatches

@facebook-github-bot facebook-github-bot added React Core Team Opened by a member of the React Core Team CLA Signed labels Jun 23, 2021
@sizebot
Copy link

sizebot commented Jun 23, 2021

Comparing: d7dce57...8dc9c27

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 = 127.36 kB 127.36 kB = 40.82 kB 40.82 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 130.17 kB 130.17 kB = 41.73 kB 41.73 kB
facebook-www/ReactDOM-prod.classic.js = 405.77 kB 405.77 kB = 75.01 kB 75.01 kB
facebook-www/ReactDOM-prod.modern.js = 394.20 kB 394.20 kB = 73.24 kB 73.24 kB
facebook-www/ReactDOMForked-prod.classic.js = 405.77 kB 405.77 kB = 75.01 kB 75.01 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 8dc9c27

@gaearon gaearon marked this pull request as ready for review June 23, 2021 17:47
@gaearon gaearon requested a review from sebmarkbage June 23, 2021 18:10
@gaearon gaearon merged commit e577bfb into facebook:master Jun 23, 2021
@gaearon gaearon deleted the igc-test branch June 23, 2021 20:54
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](facebook/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](facebook/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](facebook/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](facebook/react#21734)) //<Dan Abramov>//
- **[355591add](facebook/react@355591add)**: Next/experimental release versions include commit date ([#21700](facebook/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](facebook/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](facebook/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](facebook/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](facebook/react#21714)) //<Andrew Clark>//
- **[422e0bb36](facebook/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](facebook/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](facebook/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](facebook/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](facebook/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](facebook/react#21734)) //<Dan Abramov>//
- **[355591add](facebook/react@355591add)**: Next/experimental release versions include commit date ([#21700](facebook/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](facebook/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](facebook/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](facebook/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](facebook/react#21714)) //<Andrew Clark>//
- **[422e0bb36](facebook/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](facebook/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](facebook/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](facebook/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](facebook/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](facebook/react#21734)) //<Dan Abramov>//
- **[355591add](facebook/react@355591add)**: Next/experimental release versions include commit date ([#21700](facebook/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](facebook/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](facebook/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](facebook/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](facebook/react#21714)) //<Andrew Clark>//
- **[422e0bb36](facebook/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](facebook/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](facebook/react@27c9c95e2)**: act: Bypass microtask for "default sync" updates ([#21740](facebook/react#21740)) //<Andrew Clark>//
- **[e577bfb1c](facebook/react@e577bfb1c)**: Add tests for invokeGuardedCallback ([#21734](facebook/react#21734)) //<Dan Abramov>//
- **[355591add](facebook/react@355591add)**: Next/experimental release versions include commit date ([#21700](facebook/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](facebook/react@d7dce572c)**: Remove internal `act` builds from public modules ([#21721](facebook/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](facebook/react@06f7b4f43)**: `act` should work without mock Scheduler ([#21714](facebook/react#21714)) //<Andrew Clark>//
- **[422e0bb36](facebook/react@422e0bb36)**: Delete test-utils implementation of `act` ([#21703](facebook/react#21703)) //<Andrew Clark>//

Reviewed By: rickhanlonii

Differential Revision: D29314763

fbshipit-source-id: 6c53a053e00defee0ab89f30e2f6bd2a1ff29bce
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.

4 participants