You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `afterEach(cleanup)` call also works in `describe` blocks:
141
141
142
142
```jsx
143
143
describe('when logged in', () => {
144
-
afterEach(cleanup)
144
+
afterEach(cleanup);
145
145
146
146
it('renders the user', () => {
147
-
render(<SiteHeader />)
147
+
render(<SiteHeader />);
148
148
// ...
149
149
});
150
-
})
150
+
});
151
151
```
152
152
153
153
Failing to call `cleanup` when you've called `render` could result in a memory leak and tests which are not "idempotent" (which can lead to difficult to debug errors in your tests).
Copy file name to clipboardExpand all lines: docs/Queries.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,7 +203,7 @@ A method returning a `ReactTestInstance` with matching props object
203
203
204
204
### `ByName`
205
205
206
-
> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. **DON'T USE IT**. It will be removed in next major release (v2.0). Use [`getByTestId`](#bytestid) instead. It's listed here only for back-compat purposes for early adopters of the library
207
-
A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
206
+
> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. **DON'T USE IT**. It will be removed in next major release (v2.0). Use the other alternatives, such as [`getByText`](#bytext) instead. It's listed here only for back-compat purposes for early adopters of the library
207
+
> A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches.
0 commit comments