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
Copy file name to clipboardexpand all lines: docs/migration-guides/v4.md
+42-42
Original file line number
Diff line number
Diff line change
@@ -182,13 +182,13 @@ Relates to the [Aggressive Imports Reporting mechanism](#imports). This setting
182
182
183
183
If you pass a string other than `"off"` to this option, it will represent your custom utility file from where you re-export everything from Testing Library package.
Configuring this setting like that, you'll restrict the errors reported by the plugin to only those utils being imported from this custom utility file, or some `@testing-library/*` package. The previous setting example would cause:
You can also set this setting to `"off"` to entirely opt-out Aggressive Imports Reporting mechanism, so only utils coming from Testing Library packages are reported.
227
227
228
-
```json
229
-
// .eslintrc
230
-
{
231
-
"settings": {
232
-
"testing-library/utils-module": "off"
233
-
}
234
-
}
228
+
```js
229
+
// .eslintrc.js
230
+
module.exports={
231
+
settings: {
232
+
'testing-library/utils-module':'off',
233
+
},
234
+
};
235
235
```
236
236
237
237
### `testing-library/custom-renders`
@@ -240,13 +240,13 @@ Relates to the [Aggressive Renders Reporting mechanism](#renders). This setting
240
240
241
241
If you pass an array of strings to this option, it will represent a list of function names that are valid as Testing Library custom renders.
Configuring this setting like that, you'll restrict the errors reported by the plugin related to `render` somehow to only those functions sharing a name with one of the elements of that list, or built-in `render`. The previous setting example would cause:
You can also set this setting to `"off"` to entirely opt-out Aggressive Renders Reporting mechanism, so only methods named `render` are reported as Testing Library render util.
290
290
291
-
```json
292
-
// .eslintrc
293
-
{
294
-
"settings": {
295
-
"testing-library/custom-renders": "off"
296
-
}
297
-
}
291
+
```js
292
+
// .eslintrc.js
293
+
module.exports={
294
+
settings: {
295
+
'testing-library/custom-renders':'off',
296
+
},
297
+
};
298
298
```
299
299
300
300
### `testing-library/custom-queries`
@@ -308,13 +308,13 @@ Each string passed to this list of custom queries can be:
308
308
-**pattern query (recommended)**: a custom query variant (suffix starting with "By") to be reported, so all query combinations around it are reported. For instance: `"ByIcon"` would report all `getByIcon()`, `getAllByIcon()`, `queryByIcon()` and `findByIcon()`.
309
309
-**strict query**: a specific custom query name to be reported, so only that very exact query would be reported but not any related variant. For instance: `"getByIcon"` would make the plugin to report `getByIcon()` but not `getAllByIcon()`, `queryByIcon()` or `findByIcon()`.
Configuring this setting like that, you'll restrict the errors reported by the plugin related to the queries to only those custom queries matching name or pattern from that list, or [built-in queries](https://testing-library.com/docs/queries/about). The previous setting example would cause:
@@ -344,11 +344,11 @@ findBySomethingElse('foo');
344
344
345
345
You can also set this setting to `"off"` to entirely opt-out Aggressive Queries Reporting mechanism, so only built-in queries are reported.
|`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` OR empty string in the case of dynamically changing routes (that contain square brackets) with `Gatsby.js` or `Next.js`|`^{fileName}(\_\_([A-Z]+[a-z]_?)+)_\$`|
36
36
|`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"]`|
37
+
|`customMessage`| No |`undefined`| A string used to display a custom message whenever warnings/errors are reported. |`A custom message`|
With the configuration above, if the user imports from `@testing-library/dom` or `dom-testing-library` instead of the used framework, ESLint will tell the user to import from `@testing-library/react` or `react-testing-library`.
0 commit comments