Commit a67d92d 1 parent b6a22e5 commit a67d92d Copy full SHA for a67d92d
File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,6 @@ installations requiring long-term consistency.
151
151
| [ no-test-callback] ( docs/rules/no-test-callback.md ) | Avoid using a callback in asynchronous tests | ![ recommended] [ ] | ![ fixable] [ ] |
152
152
| [ no-test-prefixes] ( docs/rules/no-test-prefixes.md ) | Use ` .only ` and ` .skip ` over ` f ` and ` x ` | ![ recommended] [ ] | ![ fixable] [ ] |
153
153
| [ no-test-return-statement] ( docs/rules/no-test-return-statement.md ) | Disallow explicitly returning from tests | | |
154
- | [ no-truthy-falsy] ( docs/rules/no-truthy-falsy.md ) | Disallow using ` toBeTruthy() ` & ` toBeFalsy() ` | | |
155
154
| [ no-try-expect] ( docs/rules/no-try-expect.md ) | Prefer using toThrow for exception tests | ![ recommended] [ ] | |
156
155
| [ prefer-called-with] ( docs/rules/prefer-called-with.md ) | Suggest using ` toBeCalledWith() ` OR ` toHaveBeenCalledWith() ` | | |
157
156
| [ prefer-expect-assertions] ( docs/rules/prefer-expect-assertions.md ) | Suggest using ` expect.assertions() ` OR ` expect.hasAssertions() ` | | |
Original file line number Diff line number Diff line change 1
1
# Disallow using ` toBeTruthy() ` & ` toBeFalsy() ` (` no-truthy-falsy ` )
2
2
3
+ ## Deprecated
4
+
5
+ This rule has been deprecated in favor of
6
+ [ ` no-restricted-matchers ` ] ( no-restricted-matchers.md ) with the following config:
7
+
8
+ ``` json
9
+ {
10
+ "rules" : {
11
+ "jest/no-restricted-matchers" : [
12
+ " error" ,
13
+ {
14
+ "toBeTruthy" : " Avoid `toBeTruthy`" ,
15
+ "toBeFalsy" : " Avoid `toBeFalsy`"
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ ```
21
+
22
+ ---
23
+
3
24
Tests against boolean values should assert true or false. Asserting ` toBeTruthy `
4
25
or ` toBeFalsy ` matches non-boolean values as well and encourages weaker tests.
5
26
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export default createRule({
9
9
description : 'Disallow using `toBeTruthy()` & `toBeFalsy()`' ,
10
10
recommended : false ,
11
11
} ,
12
+ deprecated : true ,
13
+ replacedBy : [ 'no-restricted-matchers' ] ,
12
14
messages : {
13
15
avoidMatcher : 'Avoid {{ matcherName }}' ,
14
16
} ,
You can’t perform that action at this time.
0 commit comments