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: CONTRIBUTING.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ If you ever need to update a snapshot, you can run `npm run test:update`
44
44
45
45
Based on [ESLint's Rule Naming Conventions](https://eslint.org/docs/developer-guide/working-with-rules#rule-naming-conventions), you must follow these rules:
46
46
47
-
- If your rule is disallowing something, prefix it with `no-` such as `no-debug`
47
+
- If your rule is disallowing something, prefix it with `no-` such as `no-debugging-utils`
48
48
for disallowing `debug()`.
49
49
- If your rule is suggesting to prefer a way of doing something, among other ways, you can **optionally** prefix it with
50
50
`prefer-`. For example, `prefer-screen-queries` suggests to use `screen.getByText()` from imported `screen` rather
@@ -57,11 +57,11 @@ Based on [ESLint's Rule Naming Conventions](https://eslint.org/docs/developer-gu
57
57
## Adding new rules
58
58
59
59
In the [same way as ESLint](https://eslint.org/docs/developer-guide/working-with-rules),
60
-
each rule has three files named with its identifier (e.g. `no-debug`):
60
+
each rule has three files named with its identifier (e.g. `no-debugging-utils`):
61
61
62
-
- in the `lib/rules` directory: a source file (e.g. `no-debug.ts`)
63
-
- in the `tests/lib/rules` directory: a test file (e.g. `no-debug.ts`)
64
-
- in the `docs/rules` directory: a Markdown documentation file (e.g. `no-debug.md`)
62
+
- in the `lib/rules` directory: a source file (e.g. `no-debugging-utils.ts`)
63
+
- in the `tests/lib/rules` directory: a test file (e.g. `no-debugging-utils.ts`)
64
+
- in the `docs/rules` directory: a Markdown documentation file (e.g. `no-debugging-utils.md`)
65
65
66
66
Additionally, you need to do a couple of extra things:
You can find detailed guides for migrating `eslint-plugin-testing-library` in the [migration guide docs](docs/migration-guides):
51
51
52
52
-[Migrate guide for v4](docs/migration-guides/v4.md)
53
+
-[Migrate guide for v5](docs/migration-guides/v5.md)
53
54
54
55
## Usage
55
56
@@ -68,7 +69,7 @@ Then configure the rules you want to use within `rules` property of your `.eslin
68
69
"rules": {
69
70
"testing-library/await-async-query": "error",
70
71
"testing-library/no-await-sync-query": "error",
71
-
"testing-library/no-debug": "warn",
72
+
"testing-library/no-debugging-utils": "warn",
72
73
"testing-library/no-dom-import": "off"
73
74
}
74
75
}
@@ -195,21 +196,21 @@ To enable this configuration use the `extends` property in your
195
196
|[`testing-library/no-await-sync-events`](./docs/rules/no-await-sync-events.md)| Disallow unnecessary `await` for sync events |||
196
197
|[`testing-library/no-await-sync-query`](./docs/rules/no-await-sync-query.md)| Disallow unnecessary `await` for sync queries ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
197
198
|[`testing-library/no-container`](./docs/rules/no-container.md)| Disallow the use of `container` methods ||![angular-badge][]![react-badge][]![vue-badge][]|
198
-
|[`testing-library/no-debug`](./docs/rules/no-debug.md)| Disallow the use of debugging utilities like `debug`||![angular-badge][]![react-badge][]![vue-badge][]|
199
+
|[`testing-library/no-debugging-utils`](./docs/rules/no-debugging-utils.md)| Disallow the use of debugging utilities like `debug`||![angular-badge][]![react-badge][]![vue-badge][]|
199
200
|[`testing-library/no-dom-import`](./docs/rules/no-dom-import.md)| Disallow importing from DOM Testing Library | 🔧 |![angular-badge][]![react-badge][]![vue-badge][]|
200
201
|[`testing-library/no-manual-cleanup`](./docs/rules/no-manual-cleanup.md)| Disallow the use of `cleanup`|||
201
202
|[`testing-library/no-node-access`](./docs/rules/no-node-access.md)| Disallow direct Node access ||![angular-badge][]![react-badge][]![vue-badge][]|
202
203
|[`testing-library/no-promise-in-fire-event`](./docs/rules/no-promise-in-fire-event.md)| Disallow the use of promises passed to a `fireEvent` method ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
203
-
|[`testing-library/no-render-in-setup`](./docs/rules/no-render-in-setup.md)| Disallow the use of `render` in testing frameworks setup functions |||
204
-
|[`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md)| Disallow wrapping Testing Library utils or empty callbacks in `act`|||
204
+
|[`testing-library/no-render-in-setup`](./docs/rules/no-render-in-setup.md)| Disallow the use of `render` in testing frameworks setup functions ||![angular-badge][]![react-badge][]![vue-badge][]|
205
+
|[`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md)| Disallow wrapping Testing Library utils or empty callbacks in `act`||![react-badge][]|
205
206
|[`testing-library/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][]|
206
-
|[`testing-library/no-wait-for-multiple-assertions`](./docs/rules/no-wait-for-multiple-assertions.md)| Disallow the use of multiple `expect` calls inside `waitFor`|||
207
-
|[`testing-library/no-wait-for-side-effects`](./docs/rules/no-wait-for-side-effects.md)| Disallow the use of side effects in `waitFor`|||
208
-
|[`testing-library/no-wait-for-snapshot`](./docs/rules/no-wait-for-snapshot.md)| Ensures no snapshot is generated inside of a `waitFor` call |||
207
+
|[`testing-library/no-wait-for-multiple-assertions`](./docs/rules/no-wait-for-multiple-assertions.md)| Disallow the use of multiple `expect` calls inside `waitFor`||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
208
+
|[`testing-library/no-wait-for-side-effects`](./docs/rules/no-wait-for-side-effects.md)| Disallow the use of side effects in `waitFor`||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
209
+
|[`testing-library/no-wait-for-snapshot`](./docs/rules/no-wait-for-snapshot.md)| Ensures no snapshot is generated inside of a `waitFor` call ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
209
210
|[`testing-library/prefer-explicit-assert`](./docs/rules/prefer-explicit-assert.md)| Suggest using explicit assertions rather than standalone queries |||
210
211
|[`testing-library/prefer-find-by`](./docs/rules/prefer-find-by.md)| Suggest using `find(All)By*` query instead of `waitFor` + `get(All)By*` to wait for elements | 🔧 |![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
211
-
|[`testing-library/prefer-presence-queries`](./docs/rules/prefer-presence-queries.md)| Ensure appropriate `get*`/`query*` queries are used with their respective matchers |||
212
-
|[`testing-library/prefer-query-by-disappearance`](./docs/rules/prefer-query-by-disappearance.md)| Suggest using `queryBy*` queries when waiting for disappearance |||
212
+
|[`testing-library/prefer-presence-queries`](./docs/rules/prefer-presence-queries.md)| Ensure appropriate `get*`/`query*` queries are used with their respective matchers ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
213
+
|[`testing-library/prefer-query-by-disappearance`](./docs/rules/prefer-query-by-disappearance.md)| Suggest using `queryBy*` queries when waiting for disappearance ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
213
214
|[`testing-library/prefer-screen-queries`](./docs/rules/prefer-screen-queries.md)| Suggest using `screen` while querying ||![dom-badge][]![angular-badge][]![react-badge][]![vue-badge][]|
214
215
|[`testing-library/prefer-user-event`](./docs/rules/prefer-user-event.md)| Suggest using `userEvent` over `fireEvent` for simulating user interactions |||
215
216
|[`testing-library/prefer-wait-for`](./docs/rules/prefer-wait-for.md)| Use `waitFor` instead of deprecated wait methods | 🔧 ||
Assuming you are already in v4, migrating to v5 will be easy. If you are not in v4 yet, we recommend you to follow [the proper guide to migrate to it](docs/migration-guides/v4.md).
4
+
5
+
## Overview
6
+
7
+
- Support for ESLint v8
8
+
- Drop support for Node v10. Required node version is now `^12.22.0 || ^14.17.0 || >=16.0.0`. Node v10 was EOL'd in April 2021, and ESLint v8 dropped support for it too.
9
+
- Update dependencies
10
+
-`no-debug` is now called `no-debugging-utils`
11
+
-`no-render-in-setup` is now enabled by default in the Angular, React & Vue configs
12
+
-`no-unnecessary-act`'s `isStrict` option is now `true` by default
13
+
-`no-unnecessary-act` is now enabled by default in the React config
14
+
-`no-wait-for-multiple-assertions` is now enabled by default in all configs
15
+
-`no-wait-for-side-effects` is now enabled by default in all configs
16
+
-`no-wait-for-snapshot` is now enabled by default in all configs
17
+
-`prefer-presence-queries` is now enabled by default in all configs
18
+
-`prefer-query-by-disappearance` is now enabled by default in all configs
19
+
20
+
## Steps to upgrade
21
+
22
+
-`eslint-plugin-testing-library` supports both ESLint v7 and v8, so you are fine with either version
23
+
- Making sure you are using a compatible Node version (`^12.22.0 || ^14.17.0 || >=16.0.0`), and update it if it's not the case
24
+
- Renaming `testing-library/no-debug` to `testing-library/no-debugging-utils` if you were referencing it manually somewhere
25
+
- Being aware of new rules enabled in Shared Configs which can lead to new reported errors
Copy file name to clipboardExpand all lines: docs/rules/no-debugging-utils.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Disallow the use of debugging utilities like `debug`(`testing-library/no-debug`)
1
+
# Disallow the use of debugging utilities (`testing-library/no-debugging-utils`)
2
2
3
3
Just like `console.log` statements pollutes the browser's output, debug statements also pollutes the tests if one of your teammates forgot to remove it. `debug` statements should be used when you actually want to debug your tests but should not be pushed to the codebase.
4
4
@@ -41,7 +41,7 @@ You can control which debugging utils are checked for with the `utilsToCheckFor`
0 commit comments