Skip to content

Commit 6d07cad

Browse files
committed
feat: deprecate no-try-expect in favor of no-conditional-expect
1 parent aba53e4 commit 6d07cad

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ installations requiring long-term consistency.
152152
| [no-test-callback](docs/rules/no-test-callback.md) | Avoid using a callback in asynchronous tests | ![recommended][] | ![suggest][] |
153153
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Use `.only` and `.skip` over `f` and `x` | ![recommended][] | ![fixable][] |
154154
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | |
155-
| [no-try-expect](docs/rules/no-try-expect.md) | Prefer using toThrow for exception tests | ![recommended][] | |
156155
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` OR `toHaveBeenCalledWith()` | | |
157156
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | ![suggest][] |
158157
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest to have all hooks at top level | | |

docs/rules/no-try-expect.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Prevent catch assertions in tests (`no-try-expect`)
22

3+
## Deprecated
4+
5+
This rule has been deprecated in favor of
6+
[`no-conditional-expect`](no-conditional-expect.md).
7+
8+
---
9+
310
This rule prevents the use of `expect` inside `catch` blocks.
411

512
## Rule Details

src/rules/no-try-expect.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default createRule({
1414
category: 'Best Practices',
1515
recommended: false,
1616
},
17+
deprecated: true,
18+
replacedBy: ['no-conditional-expect'],
1719
messages: {
1820
noTryExpect: [
1921
'Tests should use Jest‘s exception helpers.',

0 commit comments

Comments
 (0)