dillon1000/react

Commit

`act()` - s / flushPassiveEffects / Scheduler.unstable_flushWithoutYielding (#15591)

* s/flushPassiveEffects/unstable_flushWithoutYielding

a first crack at flushing the scheduler manually from inside act(). uses unstable_flushWithoutYielding(). The tests that changed, mostly replaced toFlushAndYield(...) with toHaveYielded(). For some tests that tested the state of the tree before flushing effects (but still after updates), I replaced act() with bacthedUpdates().

* ugh lint

* pass build, flushPassiveEffects returns nothing now

* pass test-fire

* flush all work (not just effects), add a compatibility mode

of note, unstable_flushWithoutYielding now returns a boolean much like flushPassiveEffects

* umd build for scheduler/unstable_mock, pass the fixture with it

* add a comment to Shcduler.umd.js for why we're exporting unstable_flushWithoutYielding

* run testsutilsact tests in both sync/concurrent modes

* augh lint

* use a feature flag for the missing mock scheduler warning

I also tried writing a test for it, but couldn't get the scheduler to unmock. included the failing test.

* Update ReactTestUtilsAct-test.js

- pass the mock scheduler warning test,
- rewrite some tests to use Scheduler.yieldValue
- structure concurrent/legacy suites neatly

* pass failing tests in batchedmode-test

* fix pretty/lint/import errors

* pass test-build

* nit: pull .create(null) out of the act() call
Browse files
Changed paths23 files
First-parent comparison
M fixtures/dom/.gitignore ModifiedM fixtures/dom/package.json ModifiedM fixtures/dom/public/act-dom.html ModifiedA packages/react-dom/src/__tests__/ReactTestUtilsAct-test.internal.js AddedM packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js ModifiedM packages/react-dom/src/test-utils/ReactTestUtilsAct.js ModifiedM packages/react-noop-renderer/src/createReactNoop.js ModifiedM packages/react-reconciler/src/__tests__/ReactBatchedMode-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/ReactNoopRendererAct-test.js ModifiedM packages/react-test-renderer/src/ReactTestRendererAct.js ModifiedM packages/scheduler/src/forks/SchedulerHostConfig.mock.js ModifiedM packages/shared/ReactFeatureFlags.js ModifiedM packages/shared/forks/ReactFeatureFlags.native-fb.js ModifiedM packages/shared/forks/ReactFeatureFlags.native-oss.js ModifiedM packages/shared/forks/ReactFeatureFlags.persistent.js ModifiedM packages/shared/forks/ReactFeatureFlags.test-renderer.js ModifiedM packages/shared/forks/ReactFeatureFlags.test-renderer.www.js ModifiedM packages/shared/forks/ReactFeatureFlags.www.js ModifiedM packages/shared/forks/Scheduler.umd.js ModifiedM scripts/rollup/bundles.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…