From 8fb3b64f218c78ef6f37298990c314bd788a98ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Wed, 13 Oct 2021 19:00:21 +0200 Subject: [PATCH] feat(no-wait-for-multiple-assertions): add to all configs by default (#483) BREAKING CHANGE: `no-wait-for-multiple-assertions` is now enabled by default in all configs --- README.md | 2 +- lib/configs/angular.ts | 1 + lib/configs/dom.ts | 1 + lib/configs/react.ts | 1 + lib/configs/vue.ts | 1 + lib/rules/no-wait-for-multiple-assertions.ts | 8 ++++---- tests/__snapshots__/index.test.ts.snap | 4 ++++ 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3b710fef..08b58577 100644 --- a/README.md +++ b/README.md @@ -203,7 +203,7 @@ To enable this configuration use the `extends` property in your | [`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][] | | [`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![react-badge][] | | [`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][] | -| [`testing-library/no-wait-for-multiple-assertions`](./docs/rules/no-wait-for-multiple-assertions.md) | Disallow the use of multiple `expect` calls inside `waitFor` | | | +| [`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][] | | [`testing-library/no-wait-for-side-effects`](./docs/rules/no-wait-for-side-effects.md) | Disallow the use of side effects in `waitFor` | | | | [`testing-library/no-wait-for-snapshot`](./docs/rules/no-wait-for-snapshot.md) | Ensures no snapshot is generated inside of a `waitFor` call | | | | [`testing-library/prefer-explicit-assert`](./docs/rules/prefer-explicit-assert.md) | Suggest using explicit assertions rather than standalone queries | | | diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 606ce334..6a87c5ae 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -15,6 +15,7 @@ export = { 'testing-library/no-promise-in-fire-event': 'error', 'testing-library/no-render-in-setup': 'error', 'testing-library/no-wait-for-empty-callback': 'error', + 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', 'testing-library/render-result-naming-convention': 'error', diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 261cde83..7ed01a78 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -10,6 +10,7 @@ export = { 'testing-library/no-await-sync-query': 'error', 'testing-library/no-promise-in-fire-event': 'error', 'testing-library/no-wait-for-empty-callback': 'error', + 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', }, diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 33be2846..13ce9685 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -16,6 +16,7 @@ export = { 'testing-library/no-render-in-setup': 'error', 'testing-library/no-unnecessary-act': ['error', { isStrict: true }], 'testing-library/no-wait-for-empty-callback': 'error', + 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', 'testing-library/render-result-naming-convention': 'error', diff --git a/lib/configs/vue.ts b/lib/configs/vue.ts index e8129940..d5d6b70d 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -16,6 +16,7 @@ export = { 'testing-library/no-promise-in-fire-event': 'error', 'testing-library/no-render-in-setup': 'error', 'testing-library/no-wait-for-empty-callback': 'error', + 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', 'testing-library/render-result-naming-convention': 'error', diff --git a/lib/rules/no-wait-for-multiple-assertions.ts b/lib/rules/no-wait-for-multiple-assertions.ts index 86499e89..171dd290 100644 --- a/lib/rules/no-wait-for-multiple-assertions.ts +++ b/lib/rules/no-wait-for-multiple-assertions.ts @@ -19,10 +19,10 @@ export default createTestingLibraryRule({ 'Disallow the use of multiple `expect` calls inside `waitFor`', category: 'Best Practices', recommendedConfig: { - dom: false, - angular: false, - react: false, - vue: false, + dom: 'error', + angular: 'error', + react: 'error', + vue: 'error', }, }, messages: { diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index 339d0be4..4333d287 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -20,6 +20,7 @@ Object { "testing-library/no-promise-in-fire-event": "error", "testing-library/no-render-in-setup": "error", "testing-library/no-wait-for-empty-callback": "error", + "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", "testing-library/render-result-naming-convention": "error", @@ -35,6 +36,7 @@ Object { "testing-library/no-await-sync-query": "error", "testing-library/no-promise-in-fire-event": "error", "testing-library/no-wait-for-empty-callback": "error", + "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", }, @@ -63,6 +65,7 @@ Object { }, ], "testing-library/no-wait-for-empty-callback": "error", + "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", "testing-library/render-result-naming-convention": "error", @@ -87,6 +90,7 @@ Object { "testing-library/no-promise-in-fire-event": "error", "testing-library/no-render-in-setup": "error", "testing-library/no-wait-for-empty-callback": "error", + "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", "testing-library/render-result-naming-convention": "error",