File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
docs/react-testing-library Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,26 @@ the setup and teardown of tests in individual files. For example, you can ensure
1818[ ` cleanup ` ] ( ./api#cleanup ) is called after each test and import additional
1919assertions.
2020
21- To do this with Jest, you can add the
22- [ ` setupTestFrameworkScriptFile ` ] ( https://facebook.github.io/jest/docs/en/configuration.html#setuptestframeworkscriptfile-string )
23- option to your Jest config. The setup file can be anywhere, for example
21+ To do this with Jest 24, you can add the
22+ [ ` setupFilesAfterEnv ` ] ( https://jestjs.io/docs/en/configuration.html#setupfilesafterenv-array )
23+ option to your Jest config.
24+
25+ ``` javascript
26+ // jest.config.js
27+ module .exports = {
28+ setupFilesAfterEnv: [
29+ ' react-testing-library/cleanup-after-each' ,
30+ // ... other setup files ...
31+ ],
32+ // ... other options ...
33+ }
34+ ```
35+
36+ ### Jest 23
37+
38+ Jest 23 uses the
39+ [ ` setupTestFrameworkScriptFile ` ] ( https://jestjs.io/docs/en/23.x/configuration#setuptestframeworkscriptfile-string )
40+ option in your Jest config. This setup file can be anywhere, for example
2441` jest.setup.js ` or ` ./utils/setupTests.js ` .
2542
2643If you are using the default setup from create-react-app, this option is set to
You can’t perform that action at this time.
0 commit comments