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
@@ -138,6 +138,7 @@ To enable this configuration use the `extends` property in your
138
138
|[no-manual-cleanup](docs/rules/no-manual-cleanup.md)| Disallow the use of `cleanup`|||
139
139
|[no-multiple-assertions-wait-for](docs/rules/no-multiple-assertions-wait-for.md)| Disallow the use of multiple expect inside `waitFor`|||
140
140
|[no-node-access](docs/rules/no-node-access.md)| Disallow direct Node access |![angular-badge][]![react-badge][]![vue-badge][]||
141
+
|[no-render-in-setup](docs/rules/no-render-in-setup.md)| Disallow the use of `render` in setup functions |||
141
142
|[no-promise-in-fire-event](docs/rules/no-promise-in-fire-event.md)| Disallow the use of promises passed to a `fireEvent` method |||
142
143
|[no-side-effects-wait-for](docs/rules/no-side-effects-wait-for.md)| Disallow the use of side effects inside `waitFor`|||
143
144
|[no-wait-for-empty-callback](docs/rules/no-wait-for-empty-callback.md)| Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved`|![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]||
@@ -213,6 +214,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|`testIdPattern`| Yes | None | A regex used to validate the format of the `data-testid` value. `{fileName}` can optionally be used as a placeholder and will be substituted with the name of the file OR the name of the files parent directory in the case when the file name is `index.js`|`^{fileName}(\_\_([A-Z]+[a-z]_?)+)_\$`|
30
-
|`testIdAttribute`| No |`data-testid`| A string used to specify the attribute used for querying by ID. This is only required if data-testid has been explicitly overridden in the [RTL configuration](https://testing-library.com/docs/dom-testing-library/api-queries#overriding-data-testid)|`data-my-test-attribute`|
|`testIdPattern`| Yes | None | A regex used to validate the format of the `data-testid` value. `{fileName}` can optionally be used as a placeholder and will be substituted with the name of the file OR the name of the files parent directory in the case when the file name is `index.js`|`^{fileName}(\_\_([A-Z]+[a-z]_?)+)_\$`|
30
+
|`testIdAttribute`| No |`data-testid`| A string (or array of strings) used to specify the attribute used for querying by ID. This is only required if data-testid has been explicitly overridden in the [RTL configuration](https://testing-library.com/docs/dom-testing-library/api-queries#overriding-data-testid)|`data-my-test-attribute`, `["data-testid", "testId"]`|
# Disallow the use of `render` in setup functions (no-render-in-setup)
2
+
3
+
## Rule Details
4
+
5
+
This rule disallows the usage of `render` (or a custom render function) in setup functions (`beforeEach` and `beforeAll`) in favor of moving `render` closer to test assertions.
If you use [custom render functions](https://testing-library.com/docs/example-react-redux) then you can set a config option in your `.eslintrc` to look for these.
If you would like to allow the use of `render` (or a custom render function) in _either_`beforeAll` or `beforeEach`, this can be configured using the option `allowTestingFrameworkSetupHook`. This may be useful if you have configured your tests to [skip auto cleanup](https://testing-library.com/docs/react-testing-library/setup#skipping-auto-cleanup). `allowTestingFrameworkSetupHook` is an enum that accepts either `"beforeAll"` or `"beforeEach"`.
0 commit comments