eslint-plugin-jest 27.2.2 → 27.2.3
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.
- package/lib/rules/no-deprecated-functions.js +2 -2
- package/package.json +6 -6
- package/lib/processors/__tests__/snapshot-processor.test.js +0 -36
- package/lib/rules/__tests__/consistent-test-it.test.js +0 -921
- package/lib/rules/__tests__/expect-expect.test.js +0 -347
- package/lib/rules/__tests__/fixtures/class.ts +0 -13
- package/lib/rules/__tests__/fixtures/file.ts +0 -0
- package/lib/rules/__tests__/fixtures/foo.ts +0 -1
- package/lib/rules/__tests__/fixtures/indent/indent-invalid-fixture-1.js +0 -530
- package/lib/rules/__tests__/fixtures/indent/indent-valid-fixture-1.js +0 -530
- package/lib/rules/__tests__/fixtures/react.tsx +0 -0
- package/lib/rules/__tests__/fixtures/tsconfig-withmeta.json +0 -6
- package/lib/rules/__tests__/fixtures/tsconfig.json +0 -16
- package/lib/rules/__tests__/fixtures/unstrict/file.ts +0 -0
- package/lib/rules/__tests__/fixtures/unstrict/react.tsx +0 -0
- package/lib/rules/__tests__/fixtures/unstrict/tsconfig.json +0 -15
- package/lib/rules/__tests__/max-expects.test.js +0 -330
- package/lib/rules/__tests__/max-nested-describe.test.js +0 -247
- package/lib/rules/__tests__/no-alias-methods.test.js +0 -190
- package/lib/rules/__tests__/no-commented-out-tests.test.js +0 -213
- package/lib/rules/__tests__/no-conditional-expect.test.js +0 -696
- package/lib/rules/__tests__/no-conditional-in-test.test.js +0 -777
- package/lib/rules/__tests__/no-deprecated-functions.test.js +0 -119
- package/lib/rules/__tests__/no-disabled-tests.test.js +0 -241
- package/lib/rules/__tests__/no-done-callback.test.js +0 -424
- package/lib/rules/__tests__/no-duplicate-hooks.test.js +0 -469
- package/lib/rules/__tests__/no-export.test.js +0 -107
- package/lib/rules/__tests__/no-focused-tests.test.js +0 -373
- package/lib/rules/__tests__/no-hooks.test.js +0 -90
- package/lib/rules/__tests__/no-identical-title.test.js +0 -270
- package/lib/rules/__tests__/no-if.test.js +0 -787
- package/lib/rules/__tests__/no-interpolation-in-snapshots.test.js +0 -58
- package/lib/rules/__tests__/no-jasmine-globals.test.js +0 -206
- package/lib/rules/__tests__/no-large-snapshots.test.js +0 -237
- package/lib/rules/__tests__/no-mocks-import.test.js +0 -73
- package/lib/rules/__tests__/no-restricted-jest-methods.test.js +0 -103
- package/lib/rules/__tests__/no-restricted-matchers.test.js +0 -244
- package/lib/rules/__tests__/no-standalone-expect.test.js +0 -230
- package/lib/rules/__tests__/no-test-prefixes.test.js +0 -206
- package/lib/rules/__tests__/no-test-return-statement.test.js +0 -122
- package/lib/rules/__tests__/no-untyped-mock-factory.test.js +0 -149
- package/lib/rules/__tests__/prefer-called-with.test.js +0 -40
- package/lib/rules/__tests__/prefer-comparison-matcher.test.js +0 -200
- package/lib/rules/__tests__/prefer-each.test.js +0 -295
- package/lib/rules/__tests__/prefer-equality-matcher.test.js +0 -184
- package/lib/rules/__tests__/prefer-expect-assertions.test.js +0 -1437
- package/lib/rules/__tests__/prefer-expect-resolves.test.js +0 -96
- package/lib/rules/__tests__/prefer-hooks-in-order.test.js +0 -678
- package/lib/rules/__tests__/prefer-hooks-on-top.test.js +0 -218
- package/lib/rules/__tests__/prefer-lowercase-title.test.js +0 -619
- package/lib/rules/__tests__/prefer-mock-promise-shorthand.test.js +0 -360
- package/lib/rules/__tests__/prefer-snapshot-hint.test.js +0 -784
- package/lib/rules/__tests__/prefer-spy-on.test.js +0 -100
- package/lib/rules/__tests__/prefer-strict-equal.test.js +0 -46
- package/lib/rules/__tests__/prefer-to-be.test.js +0 -438
- package/lib/rules/__tests__/prefer-to-contain.test.js +0 -301
- package/lib/rules/__tests__/prefer-to-have-length.test.js +0 -99
- package/lib/rules/__tests__/prefer-todo.test.js +0 -78
- package/lib/rules/__tests__/require-hook.test.js +0 -403
- package/lib/rules/__tests__/require-to-throw-message.test.js +0 -108
- package/lib/rules/__tests__/require-top-level-describe.test.js +0 -236
- package/lib/rules/__tests__/test-utils.js +0 -11
- package/lib/rules/__tests__/unbound-method.test.js +0 -518
- package/lib/rules/__tests__/valid-describe-callback.test.js +0 -305
- package/lib/rules/__tests__/valid-expect-in-promise.test.js +0 -1583
- package/lib/rules/__tests__/valid-expect.test.js +0 -894
- package/lib/rules/__tests__/valid-title.test.js +0 -1147
- package/lib/rules/utils/__tests__/detectJestVersion.test.js +0 -221
- package/lib/rules/utils/__tests__/parseJestFnCall.test.js +0 -809
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _utils = require("@typescript-eslint/utils");
|
|
4
|
-
var _dedent = _interopRequireDefault(require("dedent"));
|
|
5
|
-
var _preferEach = _interopRequireDefault(require("../prefer-each"));
|
|
6
|
-
var _testUtils = require("./test-utils");
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
const ruleTester = new _utils.TSESLint.RuleTester({
|
|
9
|
-
parser: _testUtils.espreeParser,
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: 2015
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
ruleTester.run('prefer-each', _preferEach.default, {
|
|
15
|
-
valid: ['it("is true", () => { expect(true).toBe(false) });', (0, _dedent.default)`
|
|
16
|
-
it.each(getNumbers())("only returns numbers that are greater than seven", number => {
|
|
17
|
-
expect(number).toBeGreaterThan(7);
|
|
18
|
-
});
|
|
19
|
-
`,
|
|
20
|
-
// while these cases could be done with .each, it's reasonable to have more
|
|
21
|
-
// complex cases that would not look good in .each, so we consider this valid
|
|
22
|
-
(0, _dedent.default)`
|
|
23
|
-
it("returns numbers that are greater than five", function () {
|
|
24
|
-
for (const number of getNumbers()) {
|
|
25
|
-
expect(number).toBeGreaterThan(5);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
`, (0, _dedent.default)`
|
|
29
|
-
it("returns things that are less than ten", function () {
|
|
30
|
-
for (const thing in things) {
|
|
31
|
-
expect(thing).toBeLessThan(10);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
`, (0, _dedent.default)`
|
|
35
|
-
it("only returns numbers that are greater than seven", function () {
|
|
36
|
-
const numbers = getNumbers();
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < numbers.length; i++) {
|
|
39
|
-
expect(numbers[i]).toBeGreaterThan(7);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
`],
|
|
43
|
-
invalid: [{
|
|
44
|
-
code: (0, _dedent.default)`
|
|
45
|
-
for (const [input, expected] of data) {
|
|
46
|
-
it(\`results in $\{expected}\`, () => {
|
|
47
|
-
expect(fn(input)).toBe(expected)
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
`,
|
|
51
|
-
errors: [{
|
|
52
|
-
data: {
|
|
53
|
-
fn: 'it'
|
|
54
|
-
},
|
|
55
|
-
messageId: 'preferEach'
|
|
56
|
-
}]
|
|
57
|
-
}, {
|
|
58
|
-
code: (0, _dedent.default)`
|
|
59
|
-
for (const [input, expected] of data) {
|
|
60
|
-
describe(\`when the input is $\{input}\`, () => {
|
|
61
|
-
it(\`results in $\{expected}\`, () => {
|
|
62
|
-
expect(fn(input)).toBe(expected)
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
`,
|
|
67
|
-
errors: [{
|
|
68
|
-
data: {
|
|
69
|
-
fn: 'describe'
|
|
70
|
-
},
|
|
71
|
-
messageId: 'preferEach'
|
|
72
|
-
}]
|
|
73
|
-
}, {
|
|
74
|
-
code: (0, _dedent.default)`
|
|
75
|
-
for (const [input, expected] of data) {
|
|
76
|
-
describe(\`when the input is $\{input}\`, () => {
|
|
77
|
-
it(\`results in $\{expected}\`, () => {
|
|
78
|
-
expect(fn(input)).toBe(expected)
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
for (const [input, expected] of data) {
|
|
84
|
-
it.skip(\`results in $\{expected}\`, () => {
|
|
85
|
-
expect(fn(input)).toBe(expected)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
`,
|
|
89
|
-
errors: [{
|
|
90
|
-
data: {
|
|
91
|
-
fn: 'describe'
|
|
92
|
-
},
|
|
93
|
-
messageId: 'preferEach'
|
|
94
|
-
}, {
|
|
95
|
-
data: {
|
|
96
|
-
fn: 'it'
|
|
97
|
-
},
|
|
98
|
-
messageId: 'preferEach'
|
|
99
|
-
}]
|
|
100
|
-
}, {
|
|
101
|
-
code: (0, _dedent.default)`
|
|
102
|
-
for (const [input, expected] of data) {
|
|
103
|
-
it.skip(\`results in $\{expected}\`, () => {
|
|
104
|
-
expect(fn(input)).toBe(expected)
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
`,
|
|
108
|
-
errors: [{
|
|
109
|
-
data: {
|
|
110
|
-
fn: 'it'
|
|
111
|
-
},
|
|
112
|
-
messageId: 'preferEach'
|
|
113
|
-
}]
|
|
114
|
-
}, {
|
|
115
|
-
code: (0, _dedent.default)`
|
|
116
|
-
it('is true', () => {
|
|
117
|
-
expect(true).toBe(false);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
for (const [input, expected] of data) {
|
|
121
|
-
it.skip(\`results in $\{expected}\`, () => {
|
|
122
|
-
expect(fn(input)).toBe(expected)
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
`,
|
|
126
|
-
errors: [{
|
|
127
|
-
data: {
|
|
128
|
-
fn: 'it'
|
|
129
|
-
},
|
|
130
|
-
messageId: 'preferEach'
|
|
131
|
-
}]
|
|
132
|
-
}, {
|
|
133
|
-
code: (0, _dedent.default)`
|
|
134
|
-
for (const [input, expected] of data) {
|
|
135
|
-
it.skip(\`results in $\{expected}\`, () => {
|
|
136
|
-
expect(fn(input)).toBe(expected)
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
it('is true', () => {
|
|
141
|
-
expect(true).toBe(false);
|
|
142
|
-
});
|
|
143
|
-
`,
|
|
144
|
-
errors: [{
|
|
145
|
-
data: {
|
|
146
|
-
fn: 'it'
|
|
147
|
-
},
|
|
148
|
-
messageId: 'preferEach'
|
|
149
|
-
}]
|
|
150
|
-
}, {
|
|
151
|
-
code: (0, _dedent.default)`
|
|
152
|
-
it('is true', () => {
|
|
153
|
-
expect(true).toBe(false);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
for (const [input, expected] of data) {
|
|
157
|
-
it.skip(\`results in $\{expected}\`, () => {
|
|
158
|
-
expect(fn(input)).toBe(expected)
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
it('is true', () => {
|
|
163
|
-
expect(true).toBe(false);
|
|
164
|
-
});
|
|
165
|
-
`,
|
|
166
|
-
errors: [{
|
|
167
|
-
data: {
|
|
168
|
-
fn: 'it'
|
|
169
|
-
},
|
|
170
|
-
messageId: 'preferEach'
|
|
171
|
-
}]
|
|
172
|
-
}, {
|
|
173
|
-
code: (0, _dedent.default)`
|
|
174
|
-
for (const [input, expected] of data) {
|
|
175
|
-
it(\`results in $\{expected}\`, () => {
|
|
176
|
-
expect(fn(input)).toBe(expected)
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it(\`results in $\{expected}\`, () => {
|
|
180
|
-
expect(fn(input)).toBe(expected)
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
`,
|
|
184
|
-
errors: [{
|
|
185
|
-
data: {
|
|
186
|
-
fn: 'describe'
|
|
187
|
-
},
|
|
188
|
-
messageId: 'preferEach'
|
|
189
|
-
}]
|
|
190
|
-
}, {
|
|
191
|
-
code: (0, _dedent.default)`
|
|
192
|
-
for (const [input, expected] of data) {
|
|
193
|
-
it(\`results in $\{expected}\`, () => {
|
|
194
|
-
expect(fn(input)).toBe(expected)
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
for (const [input, expected] of data) {
|
|
199
|
-
it(\`results in $\{expected}\`, () => {
|
|
200
|
-
expect(fn(input)).toBe(expected)
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
`,
|
|
204
|
-
errors: [{
|
|
205
|
-
data: {
|
|
206
|
-
fn: 'it'
|
|
207
|
-
},
|
|
208
|
-
messageId: 'preferEach'
|
|
209
|
-
}, {
|
|
210
|
-
data: {
|
|
211
|
-
fn: 'it'
|
|
212
|
-
},
|
|
213
|
-
messageId: 'preferEach'
|
|
214
|
-
}]
|
|
215
|
-
}, {
|
|
216
|
-
code: (0, _dedent.default)`
|
|
217
|
-
for (const [input, expected] of data) {
|
|
218
|
-
it(\`results in $\{expected}\`, () => {
|
|
219
|
-
expect(fn(input)).toBe(expected)
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
for (const [input, expected] of data) {
|
|
224
|
-
test(\`results in $\{expected}\`, () => {
|
|
225
|
-
expect(fn(input)).toBe(expected)
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
`,
|
|
229
|
-
errors: [{
|
|
230
|
-
data: {
|
|
231
|
-
fn: 'it'
|
|
232
|
-
},
|
|
233
|
-
messageId: 'preferEach'
|
|
234
|
-
}, {
|
|
235
|
-
data: {
|
|
236
|
-
fn: 'it'
|
|
237
|
-
},
|
|
238
|
-
messageId: 'preferEach'
|
|
239
|
-
}]
|
|
240
|
-
}, {
|
|
241
|
-
code: (0, _dedent.default)`
|
|
242
|
-
for (const [input, expected] of data) {
|
|
243
|
-
beforeEach(() => setupSomething(input));
|
|
244
|
-
|
|
245
|
-
test(\`results in $\{expected}\`, () => {
|
|
246
|
-
expect(doSomething()).toBe(expected)
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
`,
|
|
250
|
-
errors: [{
|
|
251
|
-
data: {
|
|
252
|
-
fn: 'describe'
|
|
253
|
-
},
|
|
254
|
-
messageId: 'preferEach'
|
|
255
|
-
}]
|
|
256
|
-
}, {
|
|
257
|
-
code: (0, _dedent.default)`
|
|
258
|
-
for (const [input, expected] of data) {
|
|
259
|
-
it("only returns numbers that are greater than seven", function () {
|
|
260
|
-
const numbers = getNumbers(input);
|
|
261
|
-
|
|
262
|
-
for (let i = 0; i < numbers.length; i++) {
|
|
263
|
-
expect(numbers[i]).toBeGreaterThan(7);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
`,
|
|
268
|
-
errors: [{
|
|
269
|
-
data: {
|
|
270
|
-
fn: 'it'
|
|
271
|
-
},
|
|
272
|
-
messageId: 'preferEach'
|
|
273
|
-
}]
|
|
274
|
-
}, {
|
|
275
|
-
code: (0, _dedent.default)`
|
|
276
|
-
for (const [input, expected] of data) {
|
|
277
|
-
beforeEach(() => setupSomething(input));
|
|
278
|
-
|
|
279
|
-
it("only returns numbers that are greater than seven", function () {
|
|
280
|
-
const numbers = getNumbers();
|
|
281
|
-
|
|
282
|
-
for (let i = 0; i < numbers.length; i++) {
|
|
283
|
-
expect(numbers[i]).toBeGreaterThan(7);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
`,
|
|
288
|
-
errors: [{
|
|
289
|
-
data: {
|
|
290
|
-
fn: 'describe'
|
|
291
|
-
},
|
|
292
|
-
messageId: 'preferEach'
|
|
293
|
-
}]
|
|
294
|
-
}]
|
|
295
|
-
});
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _utils = require("@typescript-eslint/utils");
|
|
4
|
-
var _preferEqualityMatcher = _interopRequireDefault(require("../prefer-equality-matcher"));
|
|
5
|
-
var _testUtils = require("./test-utils");
|
|
6
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
-
const ruleTester = new _utils.TSESLint.RuleTester({
|
|
8
|
-
parser: _testUtils.espreeParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2015
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const expectSuggestions = output => {
|
|
14
|
-
return ['toBe', 'toEqual', 'toStrictEqual'].map(equalityMatcher => ({
|
|
15
|
-
messageId: 'suggestEqualityMatcher',
|
|
16
|
-
data: {
|
|
17
|
-
equalityMatcher
|
|
18
|
-
},
|
|
19
|
-
output: output(equalityMatcher)
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
22
|
-
ruleTester.run('prefer-equality-matcher: ===', _preferEqualityMatcher.default, {
|
|
23
|
-
valid: ['expect.hasAssertions', 'expect.hasAssertions()', 'expect.assertions(1)', 'expect(true).toBe(...true)', 'expect(a == 1).toBe(true)', 'expect(1 == a).toBe(true)', 'expect(a == b).toBe(true)'],
|
|
24
|
-
invalid: [{
|
|
25
|
-
code: 'expect(a === b).toBe(true);',
|
|
26
|
-
errors: [{
|
|
27
|
-
messageId: 'useEqualityMatcher',
|
|
28
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).${equalityMatcher}(b);`),
|
|
29
|
-
column: 17,
|
|
30
|
-
line: 1
|
|
31
|
-
}]
|
|
32
|
-
}, {
|
|
33
|
-
code: 'expect(a === b,).toBe(true,);',
|
|
34
|
-
parserOptions: {
|
|
35
|
-
ecmaVersion: 2017
|
|
36
|
-
},
|
|
37
|
-
errors: [{
|
|
38
|
-
messageId: 'useEqualityMatcher',
|
|
39
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a,).${equalityMatcher}(b,);`),
|
|
40
|
-
column: 18,
|
|
41
|
-
line: 1
|
|
42
|
-
}]
|
|
43
|
-
}, {
|
|
44
|
-
code: 'expect(a === b).toBe(false);',
|
|
45
|
-
errors: [{
|
|
46
|
-
messageId: 'useEqualityMatcher',
|
|
47
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).not.${equalityMatcher}(b);`),
|
|
48
|
-
column: 17,
|
|
49
|
-
line: 1
|
|
50
|
-
}]
|
|
51
|
-
}, {
|
|
52
|
-
code: 'expect(a === b).resolves.toBe(true);',
|
|
53
|
-
errors: [{
|
|
54
|
-
messageId: 'useEqualityMatcher',
|
|
55
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
56
|
-
column: 26,
|
|
57
|
-
line: 1
|
|
58
|
-
}]
|
|
59
|
-
}, {
|
|
60
|
-
code: 'expect(a === b).resolves.toBe(false);',
|
|
61
|
-
errors: [{
|
|
62
|
-
messageId: 'useEqualityMatcher',
|
|
63
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.not.${equalityMatcher}(b);`),
|
|
64
|
-
column: 26,
|
|
65
|
-
line: 1
|
|
66
|
-
}]
|
|
67
|
-
}, {
|
|
68
|
-
code: 'expect(a === b).not.toBe(true);',
|
|
69
|
-
errors: [{
|
|
70
|
-
messageId: 'useEqualityMatcher',
|
|
71
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).not.${equalityMatcher}(b);`),
|
|
72
|
-
column: 21,
|
|
73
|
-
line: 1
|
|
74
|
-
}]
|
|
75
|
-
}, {
|
|
76
|
-
code: 'expect(a === b).not.toBe(false);',
|
|
77
|
-
errors: [{
|
|
78
|
-
messageId: 'useEqualityMatcher',
|
|
79
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).${equalityMatcher}(b);`),
|
|
80
|
-
column: 21,
|
|
81
|
-
line: 1
|
|
82
|
-
}]
|
|
83
|
-
}, {
|
|
84
|
-
code: 'expect(a === b).resolves.not.toBe(true);',
|
|
85
|
-
errors: [{
|
|
86
|
-
messageId: 'useEqualityMatcher',
|
|
87
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.not.${equalityMatcher}(b);`),
|
|
88
|
-
column: 30,
|
|
89
|
-
line: 1
|
|
90
|
-
}]
|
|
91
|
-
}, {
|
|
92
|
-
code: 'expect(a === b).resolves.not.toBe(false);',
|
|
93
|
-
errors: [{
|
|
94
|
-
messageId: 'useEqualityMatcher',
|
|
95
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
96
|
-
column: 30,
|
|
97
|
-
line: 1
|
|
98
|
-
}]
|
|
99
|
-
}, {
|
|
100
|
-
code: 'expect(a === b)["resolves"].not.toBe(false);',
|
|
101
|
-
errors: [{
|
|
102
|
-
messageId: 'useEqualityMatcher',
|
|
103
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
104
|
-
column: 33,
|
|
105
|
-
line: 1
|
|
106
|
-
}]
|
|
107
|
-
}, {
|
|
108
|
-
code: 'expect(a === b)["resolves"]["not"]["toBe"](false);',
|
|
109
|
-
errors: [{
|
|
110
|
-
messageId: 'useEqualityMatcher',
|
|
111
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
112
|
-
column: 36,
|
|
113
|
-
line: 1
|
|
114
|
-
}]
|
|
115
|
-
}]
|
|
116
|
-
});
|
|
117
|
-
ruleTester.run('prefer-equality-matcher: !==', _preferEqualityMatcher.default, {
|
|
118
|
-
valid: ['expect.hasAssertions', 'expect.hasAssertions()', 'expect.assertions(1)', 'expect(true).toBe(...true)', 'expect(a != 1).toBe(true)', 'expect(1 != a).toBe(true)', 'expect(a != b).toBe(true)'],
|
|
119
|
-
invalid: [{
|
|
120
|
-
code: 'expect(a !== b).toBe(true);',
|
|
121
|
-
errors: [{
|
|
122
|
-
messageId: 'useEqualityMatcher',
|
|
123
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).not.${equalityMatcher}(b);`),
|
|
124
|
-
column: 17,
|
|
125
|
-
line: 1
|
|
126
|
-
}]
|
|
127
|
-
}, {
|
|
128
|
-
code: 'expect(a !== b).toBe(false);',
|
|
129
|
-
errors: [{
|
|
130
|
-
messageId: 'useEqualityMatcher',
|
|
131
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).${equalityMatcher}(b);`),
|
|
132
|
-
column: 17,
|
|
133
|
-
line: 1
|
|
134
|
-
}]
|
|
135
|
-
}, {
|
|
136
|
-
code: 'expect(a !== b).resolves.toBe(true);',
|
|
137
|
-
errors: [{
|
|
138
|
-
messageId: 'useEqualityMatcher',
|
|
139
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.not.${equalityMatcher}(b);`),
|
|
140
|
-
column: 26,
|
|
141
|
-
line: 1
|
|
142
|
-
}]
|
|
143
|
-
}, {
|
|
144
|
-
code: 'expect(a !== b).resolves.toBe(false);',
|
|
145
|
-
errors: [{
|
|
146
|
-
messageId: 'useEqualityMatcher',
|
|
147
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
148
|
-
column: 26,
|
|
149
|
-
line: 1
|
|
150
|
-
}]
|
|
151
|
-
}, {
|
|
152
|
-
code: 'expect(a !== b).not.toBe(true);',
|
|
153
|
-
errors: [{
|
|
154
|
-
messageId: 'useEqualityMatcher',
|
|
155
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).${equalityMatcher}(b);`),
|
|
156
|
-
column: 21,
|
|
157
|
-
line: 1
|
|
158
|
-
}]
|
|
159
|
-
}, {
|
|
160
|
-
code: 'expect(a !== b).not.toBe(false);',
|
|
161
|
-
errors: [{
|
|
162
|
-
messageId: 'useEqualityMatcher',
|
|
163
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).not.${equalityMatcher}(b);`),
|
|
164
|
-
column: 21,
|
|
165
|
-
line: 1
|
|
166
|
-
}]
|
|
167
|
-
}, {
|
|
168
|
-
code: 'expect(a !== b).resolves.not.toBe(true);',
|
|
169
|
-
errors: [{
|
|
170
|
-
messageId: 'useEqualityMatcher',
|
|
171
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.${equalityMatcher}(b);`),
|
|
172
|
-
column: 30,
|
|
173
|
-
line: 1
|
|
174
|
-
}]
|
|
175
|
-
}, {
|
|
176
|
-
code: 'expect(a !== b).resolves.not.toBe(false);',
|
|
177
|
-
errors: [{
|
|
178
|
-
messageId: 'useEqualityMatcher',
|
|
179
|
-
suggestions: expectSuggestions(equalityMatcher => `expect(a).resolves.not.${equalityMatcher}(b);`),
|
|
180
|
-
column: 30,
|
|
181
|
-
line: 1
|
|
182
|
-
}]
|
|
183
|
-
}]
|
|
184
|
-
});
|