Skip to content

Commit ec19154

Browse files
committed
feat: add prefer-to-have-been-called-times to style config
BREAKING CHANGE: `prefer-to-have-been-called-times` is now enabled in the `style` config
1 parent 4e87bed commit ec19154

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ Manually fixable by
380380
| [prefer-to-be](docs/rules/prefer-to-be.md) | Suggest using `toBe()` for primitive literals | 🎨 | | 🔧 | |
381381
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | 🎨 | | 🔧 | |
382382
| [prefer-to-have-been-called](docs/rules/prefer-to-have-been-called.md) | Suggest using `toHaveBeenCalled` | 🎨 | | 🔧 | |
383-
| [prefer-to-have-been-called-times](docs/rules/prefer-to-have-been-called-times.md) | Suggest using `toHaveBeenCalledTimes()` | | | 🔧 | |
383+
| [prefer-to-have-been-called-times](docs/rules/prefer-to-have-been-called-times.md) | Suggest using `toHaveBeenCalledTimes()` | 🎨 | | 🔧 | |
384384
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | 🎨 | | 🔧 | |
385385
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | | 🔧 | |
386386
| [require-hook](docs/rules/require-hook.md) | Require setup and teardown code to be within a hook | | | | |

docs/rules/prefer-to-have-been-called-times.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Suggest using `toHaveBeenCalledTimes()` (`prefer-to-have-been-called-times`)
22

3+
💼 This rule is enabled in the 🎨 `style`
4+
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
5+
36
🔧 This rule is automatically fixable by the
47
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
58

src/__tests__/__snapshots__/rules.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ exports[`rules should export configs that refer to actual rules 1`] = `
253253
"jest/prefer-to-be": "error",
254254
"jest/prefer-to-contain": "error",
255255
"jest/prefer-to-have-been-called": "error",
256+
"jest/prefer-to-have-been-called-times": "error",
256257
"jest/prefer-to-have-length": "error",
257258
},
258259
},
@@ -296,6 +297,7 @@ exports[`rules should export configs that refer to actual rules 1`] = `
296297
"jest/prefer-to-be": "error",
297298
"jest/prefer-to-contain": "error",
298299
"jest/prefer-to-have-been-called": "error",
300+
"jest/prefer-to-have-been-called-times": "error",
299301
"jest/prefer-to-have-length": "error",
300302
},
301303
},

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const styleRules = {
5757
'jest/prefer-to-contain': 'error',
5858
'jest/prefer-to-have-length': 'error',
5959
'jest/prefer-to-have-been-called': 'error',
60+
'jest/prefer-to-have-been-called-times': 'error',
6061
} satisfies Record<string, TSESLint.Linter.RuleLevel>;
6162

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

0 commit comments

Comments
 (0)