Skip to content

Commit

Permalink
feat(no-render-in-setup): rename to no-render-in-lifecycle (#649)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `no-render-in-setup` is now called `no-render-in-lifecycle`
  • Loading branch information
skovy authored and MichaelDeBoey committed Oct 4, 2022
1 parent 20f23ad commit 9acba43
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ To enable this configuration use the `extends` property in your
| [`no-manual-cleanup`](./docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | |
| [`no-node-access`](./docs/rules/no-node-access.md) | Disallow direct Node access | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`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][] ![marko-badge][] |
| [`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][] ![marko-badge][] |
| [`no-render-in-lifecycle`](./docs/rules/no-render-in-lifecycle.md) | Disallow the use of `render` in testing frameworks setup functions | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![react-badge][] ![marko-badge][] |
| [`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][] ![marko-badge][] |
| [`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][] ![marko-badge][] |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of `render` in setup functions (`testing-library/no-render-in-setup`)
# Disallow the use of `render` in setup functions (`testing-library/no-render-in-lifecycle`)

## Rule Details

Expand Down Expand Up @@ -77,5 +77,5 @@ it('Should have foo and bar', () => {
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"`.

```
"testing-library/no-render-in-setup": ["error", {"allowTestingFrameworkSetupHook": "beforeAll"}],
"testing-library/no-render-in-lifecycle": ["error", {"allowTestingFrameworkSetupHook": "beforeAll"}],
```
2 changes: 1 addition & 1 deletion lib/configs/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export = {
'testing-library/no-dom-import': ['error', 'angular'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-render-in-setup': 'error',
'testing-library/no-render-in-lifecycle': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
'testing-library/no-wait-for-side-effects': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/marko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export = {
'testing-library/no-dom-import': ['error', 'marko'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-render-in-setup': 'error',
'testing-library/no-render-in-lifecycle': 'error',
'testing-library/no-unnecessary-act': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export = {
'testing-library/no-dom-import': ['error', 'react'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-render-in-setup': 'error',
'testing-library/no-render-in-lifecycle': 'error',
'testing-library/no-unnecessary-act': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export = {
'testing-library/no-dom-import': ['error', 'vue'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-render-in-setup': 'error',
'testing-library/no-render-in-lifecycle': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
'testing-library/no-wait-for-side-effects': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../node-utils';
import { TESTING_FRAMEWORK_SETUP_HOOKS } from '../utils';

export const RULE_NAME = 'no-render-in-setup';
export const RULE_NAME = 'no-render-in-lifecycle';
export type MessageIds = 'noRenderInSetup';
type Options = [
{
Expand Down
8 changes: 4 additions & 4 deletions tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Object {
],
"testing-library/no-node-access": "error",
"testing-library/no-promise-in-fire-event": "error",
"testing-library/no-render-in-setup": "error",
"testing-library/no-render-in-lifecycle": "error",
"testing-library/no-wait-for-empty-callback": "error",
"testing-library/no-wait-for-multiple-assertions": "error",
"testing-library/no-wait-for-side-effects": "error",
Expand Down Expand Up @@ -66,7 +66,7 @@ Object {
],
"testing-library/no-node-access": "error",
"testing-library/no-promise-in-fire-event": "error",
"testing-library/no-render-in-setup": "error",
"testing-library/no-render-in-lifecycle": "error",
"testing-library/no-unnecessary-act": "error",
"testing-library/no-wait-for-empty-callback": "error",
"testing-library/no-wait-for-multiple-assertions": "error",
Expand Down Expand Up @@ -95,7 +95,7 @@ Object {
],
"testing-library/no-node-access": "error",
"testing-library/no-promise-in-fire-event": "error",
"testing-library/no-render-in-setup": "error",
"testing-library/no-render-in-lifecycle": "error",
"testing-library/no-unnecessary-act": "error",
"testing-library/no-wait-for-empty-callback": "error",
"testing-library/no-wait-for-multiple-assertions": "error",
Expand Down Expand Up @@ -125,7 +125,7 @@ Object {
],
"testing-library/no-node-access": "error",
"testing-library/no-promise-in-fire-event": "error",
"testing-library/no-render-in-setup": "error",
"testing-library/no-render-in-lifecycle": "error",
"testing-library/no-wait-for-empty-callback": "error",
"testing-library/no-wait-for-multiple-assertions": "error",
"testing-library/no-wait-for-side-effects": "error",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rule, { RULE_NAME } from '../../../lib/rules/no-render-in-setup';
import rule, { RULE_NAME } from '../../../lib/rules/no-render-in-lifecycle';
import { TESTING_FRAMEWORK_SETUP_HOOKS } from '../../../lib/utils';
import { createRuleTester } from '../test-utils';

Expand Down

0 comments on commit 9acba43

Please sign in to comment.