Skip to content

Commit

Permalink
feat: deprecate no-try-expect in favor of no-conditional-expect
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jun 21, 2020
1 parent aba53e4 commit 6d07cad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ installations requiring long-term consistency.
| [no-test-callback](docs/rules/no-test-callback.md) | Avoid using a callback in asynchronous tests | ![recommended][] | ![suggest][] |
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Use `.only` and `.skip` over `f` and `x` | ![recommended][] | ![fixable][] |
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | |
| [no-try-expect](docs/rules/no-try-expect.md) | Prefer using toThrow for exception tests | ![recommended][] | |
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` OR `toHaveBeenCalledWith()` | | |
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | ![suggest][] |
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest to have all hooks at top level | | |
Expand Down
7 changes: 7 additions & 0 deletions docs/rules/no-try-expect.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Prevent catch assertions in tests (`no-try-expect`)

## Deprecated

This rule has been deprecated in favor of
[`no-conditional-expect`](no-conditional-expect.md).

---

This rule prevents the use of `expect` inside `catch` blocks.

## Rule Details
Expand Down
2 changes: 2 additions & 0 deletions src/rules/no-try-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default createRule({
category: 'Best Practices',
recommended: false,
},
deprecated: true,
replacedBy: ['no-conditional-expect'],
messages: {
noTryExpect: [
'Tests should use Jest‘s exception helpers.',
Expand Down

0 comments on commit 6d07cad

Please sign in to comment.