Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests
  • Loading branch information
rickhanlonii committed May 31, 2023
commit aa86e109c2a6d29b1d56f9914e53d3406bf949d9
29 changes: 14 additions & 15 deletions packages/react-reconciler/src/__tests__/ReactExpiration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,20 @@ describe('ReactExpiration', () => {

it('increases priority of updates as time progresses', async () => {
if (gate(flags => flags.forceConcurrentByDefaultForTesting)) {
// TODO: How does this pass on main?
// ReactNoop.render(<span prop="done" />);
// expect(ReactNoop).toMatchRenderedOutput(null);
//
// // Nothing has expired yet because time hasn't advanced.
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(null);
// // Advance time a bit, but not enough to expire the low pri update.
// ReactNoop.expire(4500);
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(null);
// // Advance by another second. Now the update should expire and flush.
// ReactNoop.expire(500);
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(<span prop="done" />);
ReactNoop.render(<span prop="done" />);
expect(ReactNoop).toMatchRenderedOutput(null);

// Nothing has expired yet because time hasn't advanced.
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(null);
// Advance time a bit, but not enough to expire the low pri update.
ReactNoop.expire(4500);
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(null);
// Advance by another second. Now the update should expire and flush.
ReactNoop.expire(500);
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(<span prop="done" />);
} else {
ReactNoop.render(<Text text="Step 1" />);
React.startTransition(() => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/jest/setupTests.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jest.mock('shared/ReactFeatureFlags', () => {
const actual = jest.requireActual('shared/forks/ReactFeatureFlags.www');

// This flag is only used by tests, it should never be set elsewhere.
actual.forceConcurrentByDefaultForTesting = __VARIANT__;
actual.forceConcurrentByDefaultForTesting = !__VARIANT__;

return actual;
});
Expand Down