@@ -96,11 +96,10 @@ const AllTheProviders: FC = ({ children }) => {
9696
9797const customRender = (
9898 ui : ReactElement ,
99- options ? : Omit <RenderOptions , ' queries ' >
99+ options ? : Omit <RenderOptions , ' wrapper ' >
100100) => render (ui , { wrapper: AllTheProviders , ... options })
101101
102102export * from ' @testing-library/react'
103-
104103export { customRender as render }
105104```
106105
@@ -194,7 +193,12 @@ passing a [`queries`](api.mdx#render-options) option.
194193If you want to add custom queries globally, you can do this by defining a custom
195194render method:
196195
197- ``` js title="test-utils.js"
196+ <Tabs groupId = " test-utils" defaultValue = " jsx" values = { [ {label: ' Javascript' ,
197+ value: ' jsx' }, {label: ' Typescript' , value: ' tsx' }, ]} >
198+
199+ <TabItem value = " jsx" >
200+
201+ ``` jsx title="test-utils.js"
198202// test-utils.js
199203import { render , queries } from ' @testing-library/react'
200204import * as customQueries from ' ./custom-queries'
@@ -209,6 +213,28 @@ export * from '@testing-library/react'
209213export { customRender as render }
210214```
211215
216+ </TabItem >
217+
218+ <TabItem value = " tsx" >
219+
220+ ``` tsx title="test-utils.ts"
221+ // test-utils.ts
222+ import { render , queries , RenderOptions } from ' @testing-library/react'
223+ import * as customQueries from ' ./custom-queries'
224+ import { ReactElement } from ' react'
225+
226+ const customRender = (
227+ ui : ReactElement ,
228+ options ? : Omit <RenderOptions , ' queries' >
229+ ) => render (ui , { queries: { ... queries , ... customQueries }, ... options })
230+
231+ export * from ' @testing-library/react'
232+ export { customRender as render }
233+ ```
234+
235+ </TabItem >
236+ </Tabs >
237+
212238You can then use your custom queries as you would any other query:
213239
214240``` js
0 commit comments