GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Convert ReactErrorBoundariesHooks to createRoot (#28175) · react/react@d0aa081

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-dom/src/__tests__
    • ReactErrorBoundariesHooks-test.internal.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-dom/src/__tests__/ReactErrorBoundariesHooks-test.internal.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactErrorBoundariesHooks-test.internal.js
+14-7Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
'use strict';
1111

1212
let React;
13-
let ReactDOM;
13+
let ReactDOMClient;
14+
let act;
1415

1516
describe('ReactErrorBoundariesHooks', () => {
1617
beforeEach(() => {
1718
jest.resetModules();
18-
ReactDOM = require('react-dom');
1919
React = require('react');
20+
ReactDOMClient = require('react-dom/client');
21+
act = require('internal-test-utils').act;
2022
});
2123

22-
it('should preserve hook order if errors are caught', () => {
24+
it('should preserve hook order if errors are caught', async () => {
2325
function ErrorThrower() {
2426
React.useMemo(() => undefined, []);
2527
throw new Error('expected');
@@ -57,10 +59,15 @@ describe('ReactErrorBoundariesHooks', () => {
5759
}
5860

5961
const container = document.createElement('div');
60-
ReactDOM.render(<App />, container);
62+
const root = ReactDOMClient.createRoot(container);
63+
await act(() => {
64+
root.render(<App />);
65+
});
6166

62-
expect(() => {
63-
ReactDOM.render(<App />, container);
64-
}).not.toThrow();
67+
await expect(
68+
act(() => {
69+
root.render(<App />);
70+
}),
71+
).resolves.not.toThrow();
6572
});
6673
});

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.