Skip to content

Commit

Permalink
Handle different error counts depending on renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Silbermann committed Jan 28, 2024
1 parent d1eb303 commit 110637a
Showing 1 changed file with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ function initModules() {
};
}

const {resetModules, itRenders, itThrowsWhenRendering, serverRender} =
ReactDOMServerIntegrationUtils(initModules);
const {
resetModules,
itRenders,
itThrowsWhenRendering,
clientRenderOnBadMarkup,
serverRender,
} = ReactDOMServerIntegrationUtils(initModules);

describe('ReactDOMServerHooks', () => {
beforeEach(() => {
Expand Down Expand Up @@ -422,8 +427,13 @@ describe('ReactDOMServerHooks', () => {
});
return 'hi';
}
// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
const domNode = await render(
<App />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode.textContent).toEqual('hi');
});

Expand All @@ -436,8 +446,13 @@ describe('ReactDOMServerHooks', () => {
return value;
}

// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
const domNode = await render(
<App />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode.textContent).toEqual('0');
});
});
Expand Down Expand Up @@ -860,11 +875,15 @@ describe('ReactDOMServerHooks', () => {
return <Text text={count} />;
}

// TODO: fails due to render error retry
const domNode1 = await render(<ReadInMemo />, 1);
const domNode1 = await render(
<ReadInMemo />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode1.textContent).toEqual('42');

// TODO: fails due to render error retry
const domNode2 = await render(<ReadInReducer />, 1);
expect(domNode2.textContent).toEqual('42');
});
Expand Down

0 comments on commit 110637a

Please sign in to comment.