Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Manually fixable by
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | Disallow using `expect` outside of `it` or `test` blocks | ✅ | | | |
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Require using `.only` and `.skip` over `f` and `x` | ✅ | | 🔧 | |
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | | | |
| [no-unneeded-async-expect-function](docs/rules/no-unneeded-async-expect-function.md) | Disallow unnecessary async function wrapper for expected promises | | | 🔧 | |
| [no-unneeded-async-expect-function](docs/rules/no-unneeded-async-expect-function.md) | Disallow unnecessary async function wrapper for expected promises | | | 🔧 | |
| [no-untyped-mock-factory](docs/rules/no-untyped-mock-factory.md) | Disallow using `jest.mock()` factories without an explicit type parameter | | | 🔧 | |
| [padding-around-after-all-blocks](docs/rules/padding-around-after-all-blocks.md) | Enforce padding around `afterAll` blocks | | | 🔧 | |
| [padding-around-after-each-blocks](docs/rules/padding-around-after-each-blocks.md) | Enforce padding around `afterEach` blocks | | | 🔧 | |
Expand Down Expand Up @@ -379,8 +379,8 @@ Manually fixable by
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using `toStrictEqual()` | | | | 💡 |
| [prefer-to-be](docs/rules/prefer-to-be.md) | Suggest using `toBe()` for primitive literals | 🎨 | | 🔧 | |
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | 🎨 | | 🔧 | |
| [prefer-to-have-been-called](docs/rules/prefer-to-have-been-called.md) | Suggest using `toHaveBeenCalled` | | | 🔧 | |
| [prefer-to-have-been-called-times](docs/rules/prefer-to-have-been-called-times.md) | Suggest using `toHaveBeenCalledTimes()` | | | 🔧 | |
| [prefer-to-have-been-called](docs/rules/prefer-to-have-been-called.md) | Suggest using `toHaveBeenCalled` | 🎨 | | 🔧 | |
| [prefer-to-have-been-called-times](docs/rules/prefer-to-have-been-called-times.md) | Suggest using `toHaveBeenCalledTimes()` | 🎨 | | 🔧 | |
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | 🎨 | | 🔧 | |
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | | 🔧 | |
| [require-hook](docs/rules/require-hook.md) | Require setup and teardown code to be within a hook | | | | |
Expand Down
3 changes: 3 additions & 0 deletions docs/rules/no-unneeded-async-expect-function.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Disallow unnecessary async function wrapper for expected promises (`no-unneeded-async-expect-function`)

💼 This rule is enabled in the ✅ `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

🔧 This rule is automatically fixable by the
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
3 changes: 3 additions & 0 deletions docs/rules/prefer-to-have-been-called-times.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Suggest using `toHaveBeenCalledTimes()` (`prefer-to-have-been-called-times`)

💼 This rule is enabled in the 🎨 `style`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

🔧 This rule is automatically fixable by the
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
3 changes: 3 additions & 0 deletions docs/rules/prefer-to-have-been-called.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Suggest using `toHaveBeenCalled` (`prefer-to-have-been-called`)

💼 This rule is enabled in the 🎨 `style`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

🔧 This rule is automatically fixable by the
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
6 changes: 6 additions & 0 deletions src/__tests__/__snapshots__/rules.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ exports[`rules should export configs that refer to actual rules 1`] = `
"jest/no-mocks-import": "error",
"jest/no-standalone-expect": "error",
"jest/no-test-prefixes": "error",
"jest/no-unneeded-async-expect-function": "error",
"jest/valid-describe-callback": "error",
"jest/valid-expect": "error",
"jest/valid-expect-in-promise": "error",
Expand Down Expand Up @@ -252,6 +253,8 @@ exports[`rules should export configs that refer to actual rules 1`] = `
"rules": {
"jest/prefer-to-be": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-been-called": "error",
"jest/prefer-to-have-been-called-times": "error",
"jest/prefer-to-have-length": "error",
},
},
Expand All @@ -278,6 +281,7 @@ exports[`rules should export configs that refer to actual rules 1`] = `
"jest/no-mocks-import": "error",
"jest/no-standalone-expect": "error",
"jest/no-test-prefixes": "error",
"jest/no-unneeded-async-expect-function": "error",
"jest/valid-describe-callback": "error",
"jest/valid-expect": "error",
"jest/valid-expect-in-promise": "error",
Expand All @@ -294,6 +298,8 @@ exports[`rules should export configs that refer to actual rules 1`] = `
"rules": {
"jest/prefer-to-be": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-been-called": "error",
"jest/prefer-to-have-been-called-times": "error",
"jest/prefer-to-have-length": "error",
},
},
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const recommendedRules = {
'jest/no-mocks-import': 'error',
'jest/no-standalone-expect': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-unneeded-async-expect-function': 'error',
'jest/valid-describe-callback': 'error',
'jest/valid-expect': 'error',
'jest/valid-expect-in-promise': 'error',
Expand All @@ -56,6 +57,8 @@ const styleRules = {
'jest/prefer-to-be': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error',
'jest/prefer-to-have-been-called': 'error',
'jest/prefer-to-have-been-called-times': 'error',
} satisfies Record<string, TSESLint.Linter.RuleLevel>;

const allRules = Object.fromEntries<TSESLint.Linter.RuleLevel>(
Expand Down