@@ -4,12 +4,12 @@ title: Setup
4
4
sidebar_label : Setup
5
5
---
6
6
7
- ` React Testing Library ` does not require any configuration to be used (as
8
- demonstrated in the example above). However, there are some things you can do
9
- when configuring your testing framework to reduce some boilerplate. In these
10
- docs we'll demonstrate configuring Jest, but you should be able to do similar
11
- things with [ any testing framework] ( #using-without-jest ) (React Testing Library
12
- does not require that you use Jest).
7
+ ` React Testing Library ` does not require any configuration to be used. However,
8
+ there are some things you can do when configuring your testing framework to
9
+ reduce some boilerplate. In these docs we'll demonstrate configuring Jest, but
10
+ you should be able to do similar things with
11
+ [ any testing framework] ( #using-without-jest ) (React Testing Library does not
12
+ require that you use Jest).
13
13
14
14
## Global Config
15
15
@@ -25,8 +25,8 @@ approach is to define a utility file that re-exports everything from
25
25
all your imports. See [ below] ( #configuring-jest-with-test-utils ) for a way to
26
26
make your test util file accessible without using relative paths.
27
27
28
- The example below sets up data providers using the
29
- [ ` wrapper ` ] ( api.md#wrapper ) option to ` render ` .
28
+ The example below sets up data providers using the [ ` wrapper ` ] ( api.md#wrapper )
29
+ option to ` render ` .
30
30
31
31
``` diff
32
32
// my-component.test.js
@@ -36,7 +36,7 @@ The example below sets up data providers using the
36
36
37
37
``` js
38
38
// test-utils.js
39
- import React from " react"
39
+ import React from ' react'
40
40
import { render } from ' @testing-library/react'
41
41
import { ThemeProvider } from ' my-ui-lib'
42
42
import { TranslationProvider } from ' my-i18n-lib'
@@ -103,8 +103,8 @@ module.exports = {
103
103
104
104
You can define your own custom queries as described in the example in the
105
105
[ Helpers API] ( /docs/dom-testing-library/api-helpers ) documentation, or via the
106
- [ ` buildQueries ` ] ( /docs/dom-testing-library/api-helpers#buildqueries ) helper. Then
107
- you can use them in any render call using the ` queries ` option. To make the
106
+ [ ` buildQueries ` ] ( /docs/dom-testing-library/api-helpers#buildqueries ) helper.
107
+ Then you can use them in any render call using the ` queries ` option. To make the
108
108
custom queries available globally, you can add them to your custom render method
109
109
as shown below.
110
110
@@ -328,6 +328,6 @@ Or with mocha's `-r` flag:
328
328
mocha -r @testing-library/react/dont-cleanup-after-each
329
329
```
330
330
331
- Alternatively, you could import ` @testing-library/react/pure ` in all your
332
- tests that you don't want the ` cleanup ` to run and the ` afterEach ` won't
333
- be setup automatically.
331
+ Alternatively, you could import ` @testing-library/react/pure ` in all your tests
332
+ that you don't want the ` cleanup ` to run and the ` afterEach ` won't be setup
333
+ automatically.
0 commit comments