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

fix[react-devtools/store-test]: fork the test to represent current be… #29777

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
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
33 changes: 31 additions & 2 deletions packages/react-devtools-shared/src/__tests__/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1915,8 +1915,12 @@ describe('Store', () => {
});
});

// @reactVersion >= 18.0
it('from react get counted', () => {
// In React 19, JSX warnings were moved into the renderer - https://github.com/facebook/react/pull/29088
// When the error is emitted, the source fiber of this error is not yet mounted
// So DevTools can't connect the error and the fiber
// TODO(hoxyq): update RDT to keep track of such fibers
// @reactVersion >= 19.0
it('from react get counted [React >= 19]', () => {
function Example() {
return [<Child />];
}
Expand All @@ -1938,6 +1942,31 @@ describe('Store', () => {
`);
});

// @reactVersion >= 18.0
// @reactVersion < 19.0
it('from react get counted [React 18.x]', () => {
function Example() {
return [<Child />];
}
function Child() {
return null;
}

withErrorsOrWarningsIgnored(
['Warning: Each child in a list should have a unique "key" prop'],
() => {
act(() => render(<Example />));
},
);

expect(store).toMatchInlineSnapshot(`
✕ 1, ⚠ 0
[root]
▾ <Example> ✕
<Child>
`);
});

// @reactVersion >= 18.0
it('can be cleared for the whole app', () => {
function Example() {
Expand Down