Skip to content

Commit 78f2426

Browse files
committed
revert: #11ffbf365222eeb348cc14345fffd88fca6855f9
1 parent 941c8e3 commit 78f2426

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

Diff for: docs/react-testing-library/api.mdx

-24
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ as these methods:
1212
- [`baseElement`](#baseelement)
1313
- [`hydrate`](#hydrate)
1414
- [`legacyRoot`](#legacyroot)
15-
- [`onCaughtError`](#oncaughterror)
16-
- [`onRecoverableError`](#onrecoverableerror)
1715
- [`wrapper`](#wrapper)
1816
- [`queries`](#queries)
1917
- [`render` Result](#render-result)
@@ -29,8 +27,6 @@ as these methods:
2927
- [`renderHook`](#renderhook)
3028
- [`renderHook` Options](#renderhook-options)
3129
- [`initialProps`](#initialprops)
32-
- [`onCaughtError`](#oncaughterror)
33-
- [`onRecoverableError`](#onrecoverableerror)
3430
- [`wrapper`](#wrapper-1)
3531
- [`renderHook` Result](#renderhook-result)
3632
- [`result`](#result)
@@ -124,16 +120,6 @@ React 17 (i.e.
124120
[`ReactDOM.render`](https://react.dev/reference/react-dom/render)) then you
125121
should enable this option by setting `legacyRoot: true`.
126122

127-
### `onCaughtError`
128-
129-
Callback called when React catches an error in an Error Boundary.
130-
Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters).
131-
132-
### `onRecoverableError`
133-
134-
Callback called when React automatically recovers from errors.
135-
Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters).
136-
137123
### `wrapper`
138124

139125
Pass a React Component as the `wrapper` option to have it rendered around the
@@ -417,16 +403,6 @@ test('returns logged in user', () => {
417403
> }
418404
> ```
419405
420-
### `onCaughtError`
421-
422-
Callback called when React catches an error in an Error Boundary.
423-
Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters).
424-
425-
### `onRecoverableError`
426-
427-
Callback called when React automatically recovers from errors.
428-
Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters).
429-
430406
### `renderHook` Options `wrapper`
431407
432408
See [`wrapper` option for `render`](#wrapper)

Diff for: docs/react-testing-library/faq.mdx

-51
Original file line numberDiff line numberDiff line change
@@ -81,57 +81,6 @@ as part of the `change` method call.
8181

8282
<details>
8383

84-
<summary>How do I test error boundaries</summary>
85-
86-
To test if an error boundary successfully catches an error, you should make sure that the fallback of the boundary is displayed when a child threw.
87-
88-
Here's an example of how you can test an error boundary:
89-
90-
```jsx
91-
import React from 'react'
92-
import {render, screen} from '@testing-library/react'
93-
94-
class ErrorBoundary extends React.Component {
95-
state = {error: null}
96-
static getDerivedStateFromError(error) {
97-
return {error}
98-
}
99-
render() {
100-
const {error} = this.state
101-
if (error) {
102-
return <div>Something went wrong</div>
103-
}
104-
return this.props.children
105-
}
106-
}
107-
108-
test('error boundary catches error', () => {
109-
const {container} = render(
110-
<ErrorBoundary>
111-
<BrokenComponent />
112-
</ErrorBoundary>,
113-
)
114-
expect(container.textContent).toEqual('Something went wrong.')
115-
})
116-
```
117-
118-
If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced.
119-
120-
121-
:::info
122-
123-
React 18 will call `console.error` with an extended error message.
124-
React 19 will call `console.warn` with an extended error message.
125-
126-
To disable the additional `console.warn` call in React 19, you can provide a custom `onCaughtError` callback e.g. `render(<App />, {onCaughtError: () => {}})`
127-
`onCaughtError` is not supported in React 18.
128-
129-
:::
130-
131-
</details>
132-
133-
<details>
134-
13584
<summary>Can I write unit tests with this library?</summary>
13685

13786
Definitely yes! You can write unit and integration tests with this library. See

0 commit comments

Comments
 (0)