eslint-plugin-jest 22.16.0 → 22.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,7 +5,8 @@ asserting expections on null value.
|
|
|
5
5
|
|
|
6
6
|
## Rule details
|
|
7
7
|
|
|
8
|
-
This rule triggers a warning if `toBe()`
|
|
8
|
+
This rule triggers a warning if `toBe()`, `isEqual()` or `toStrictEqual()` is
|
|
9
|
+
used to assert a null value.
|
|
9
10
|
|
|
10
11
|
```js
|
|
11
12
|
expect(null).toBe(null);
|
|
@@ -15,10 +16,14 @@ This rule is enabled by default.
|
|
|
15
16
|
|
|
16
17
|
### Default configuration
|
|
17
18
|
|
|
18
|
-
The following
|
|
19
|
+
The following patterns are considered warnings:
|
|
19
20
|
|
|
20
21
|
```js
|
|
21
22
|
expect(null).toBe(null);
|
|
23
|
+
|
|
24
|
+
expect(null).isEqual(null);
|
|
25
|
+
|
|
26
|
+
expect(null).toStrictEqual(null);
|
|
22
27
|
```
|
|
23
28
|
|
|
24
29
|
The following pattern is not warning:
|
|
@@ -5,7 +5,8 @@ asserting expections on undefined value.
|
|
|
5
5
|
|
|
6
6
|
## Rule details
|
|
7
7
|
|
|
8
|
-
This rule triggers a warning if `toBe()`
|
|
8
|
+
This rule triggers a warning if `toBe()`, `isEqual()` or `toStrictEqual()` is
|
|
9
|
+
used to assert an undefined value.
|
|
9
10
|
|
|
10
11
|
```js
|
|
11
12
|
expect(undefined).toBe(undefined);
|
|
@@ -15,10 +16,14 @@ This rule is enabled by default.
|
|
|
15
16
|
|
|
16
17
|
### Default configuration
|
|
17
18
|
|
|
18
|
-
The following
|
|
19
|
+
The following patterns are considered warnings:
|
|
19
20
|
|
|
20
21
|
```js
|
|
21
22
|
expect(undefined).toBe(undefined);
|
|
23
|
+
|
|
24
|
+
expect(undefined).isEqual(undefined);
|
|
25
|
+
|
|
26
|
+
expect(undefined).toStrictEqual(undefined);
|
|
22
27
|
```
|
|
23
28
|
|
|
24
29
|
The following pattern is not warning:
|
|
@@ -5,8 +5,8 @@ asserting expectations on an array containing an object.
|
|
|
5
5
|
|
|
6
6
|
## Rule details
|
|
7
7
|
|
|
8
|
-
This rule triggers a warning if `toBe()` or `
|
|
9
|
-
inclusion in an array
|
|
8
|
+
This rule triggers a warning if `toBe()`, `isEqual()` or `toStrictEqual()` is
|
|
9
|
+
used to assert object inclusion in an array
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
expect(a.includes(b)).toBe(true);
|
|
@@ -22,26 +22,24 @@ expect(a.includes(b)).toBe(false);
|
|
|
22
22
|
|
|
23
23
|
### Default configuration
|
|
24
24
|
|
|
25
|
-
The following patterns are considered
|
|
25
|
+
The following patterns are considered warnings:
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
expect(a.includes(b)).toBe(true);
|
|
29
|
-
```
|
|
30
29
|
|
|
31
|
-
```js
|
|
32
30
|
expect(a.includes(b)).not.toBe(true);
|
|
33
|
-
```
|
|
34
31
|
|
|
35
|
-
```js
|
|
36
32
|
expect(a.includes(b)).toBe(false);
|
|
33
|
+
|
|
34
|
+
expect(a.includes(b)).toEqual(true);
|
|
35
|
+
|
|
36
|
+
expect(a.includes(b)).toStrictEqual(true);
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
The following patterns are not
|
|
39
|
+
The following patterns are not considered warnings:
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
42
|
expect(a).toContain(b);
|
|
43
|
-
```
|
|
44
43
|
|
|
45
|
-
```js
|
|
46
44
|
expect(a).not.toContain(b);
|
|
47
45
|
```
|
|
@@ -5,8 +5,8 @@ asserting expectations on object's length property.
|
|
|
5
5
|
|
|
6
6
|
## Rule details
|
|
7
7
|
|
|
8
|
-
This rule triggers a warning if `toBe()`
|
|
9
|
-
property.
|
|
8
|
+
This rule triggers a warning if `toBe()`, `isEqual()` or `toStrictEqual()` is
|
|
9
|
+
used to assert object's length property.
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
expect(files.length).toBe(1);
|
|
@@ -16,10 +16,14 @@ This rule is enabled by default.
|
|
|
16
16
|
|
|
17
17
|
### Default configuration
|
|
18
18
|
|
|
19
|
-
The following
|
|
19
|
+
The following patterns are considered warnings:
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
22
|
expect(files.length).toBe(1);
|
|
23
|
+
|
|
24
|
+
expect(files.length).toEqual(1);
|
|
25
|
+
|
|
26
|
+
expect(files.length).toStrictEqual(1);
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
The following pattern is not warning:
|
package/lib/rules/utils.js
CHANGED
|
@@ -216,6 +216,7 @@ var EqualityMatcher;
|
|
|
216
216
|
(function (EqualityMatcher) {
|
|
217
217
|
EqualityMatcher["toBe"] = "toBe";
|
|
218
218
|
EqualityMatcher["toEqual"] = "toEqual";
|
|
219
|
+
EqualityMatcher["toStrictEqual"] = "toStrictEqual";
|
|
219
220
|
})(EqualityMatcher || (EqualityMatcher = {}));
|
|
220
221
|
|
|
221
222
|
const isParsedEqualityMatcherCall = matcher => EqualityMatcher.hasOwnProperty(matcher.name) && matcher.arguments !== null && matcher.arguments.length === 1;
|