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.
Files changed (69) hide show
  1. package/lib/rules/no-deprecated-functions.js +2 -2
  2. package/package.json +6 -6
  3. package/lib/processors/__tests__/snapshot-processor.test.js +0 -36
  4. package/lib/rules/__tests__/consistent-test-it.test.js +0 -921
  5. package/lib/rules/__tests__/expect-expect.test.js +0 -347
  6. package/lib/rules/__tests__/fixtures/class.ts +0 -13
  7. package/lib/rules/__tests__/fixtures/file.ts +0 -0
  8. package/lib/rules/__tests__/fixtures/foo.ts +0 -1
  9. package/lib/rules/__tests__/fixtures/indent/indent-invalid-fixture-1.js +0 -530
  10. package/lib/rules/__tests__/fixtures/indent/indent-valid-fixture-1.js +0 -530
  11. package/lib/rules/__tests__/fixtures/react.tsx +0 -0
  12. package/lib/rules/__tests__/fixtures/tsconfig-withmeta.json +0 -6
  13. package/lib/rules/__tests__/fixtures/tsconfig.json +0 -16
  14. package/lib/rules/__tests__/fixtures/unstrict/file.ts +0 -0
  15. package/lib/rules/__tests__/fixtures/unstrict/react.tsx +0 -0
  16. package/lib/rules/__tests__/fixtures/unstrict/tsconfig.json +0 -15
  17. package/lib/rules/__tests__/max-expects.test.js +0 -330
  18. package/lib/rules/__tests__/max-nested-describe.test.js +0 -247
  19. package/lib/rules/__tests__/no-alias-methods.test.js +0 -190
  20. package/lib/rules/__tests__/no-commented-out-tests.test.js +0 -213
  21. package/lib/rules/__tests__/no-conditional-expect.test.js +0 -696
  22. package/lib/rules/__tests__/no-conditional-in-test.test.js +0 -777
  23. package/lib/rules/__tests__/no-deprecated-functions.test.js +0 -119
  24. package/lib/rules/__tests__/no-disabled-tests.test.js +0 -241
  25. package/lib/rules/__tests__/no-done-callback.test.js +0 -424
  26. package/lib/rules/__tests__/no-duplicate-hooks.test.js +0 -469
  27. package/lib/rules/__tests__/no-export.test.js +0 -107
  28. package/lib/rules/__tests__/no-focused-tests.test.js +0 -373
  29. package/lib/rules/__tests__/no-hooks.test.js +0 -90
  30. package/lib/rules/__tests__/no-identical-title.test.js +0 -270
  31. package/lib/rules/__tests__/no-if.test.js +0 -787
  32. package/lib/rules/__tests__/no-interpolation-in-snapshots.test.js +0 -58
  33. package/lib/rules/__tests__/no-jasmine-globals.test.js +0 -206
  34. package/lib/rules/__tests__/no-large-snapshots.test.js +0 -237
  35. package/lib/rules/__tests__/no-mocks-import.test.js +0 -73
  36. package/lib/rules/__tests__/no-restricted-jest-methods.test.js +0 -103
  37. package/lib/rules/__tests__/no-restricted-matchers.test.js +0 -244
  38. package/lib/rules/__tests__/no-standalone-expect.test.js +0 -230
  39. package/lib/rules/__tests__/no-test-prefixes.test.js +0 -206
  40. package/lib/rules/__tests__/no-test-return-statement.test.js +0 -122
  41. package/lib/rules/__tests__/no-untyped-mock-factory.test.js +0 -149
  42. package/lib/rules/__tests__/prefer-called-with.test.js +0 -40
  43. package/lib/rules/__tests__/prefer-comparison-matcher.test.js +0 -200
  44. package/lib/rules/__tests__/prefer-each.test.js +0 -295
  45. package/lib/rules/__tests__/prefer-equality-matcher.test.js +0 -184
  46. package/lib/rules/__tests__/prefer-expect-assertions.test.js +0 -1437
  47. package/lib/rules/__tests__/prefer-expect-resolves.test.js +0 -96
  48. package/lib/rules/__tests__/prefer-hooks-in-order.test.js +0 -678
  49. package/lib/rules/__tests__/prefer-hooks-on-top.test.js +0 -218
  50. package/lib/rules/__tests__/prefer-lowercase-title.test.js +0 -619
  51. package/lib/rules/__tests__/prefer-mock-promise-shorthand.test.js +0 -360
  52. package/lib/rules/__tests__/prefer-snapshot-hint.test.js +0 -784
  53. package/lib/rules/__tests__/prefer-spy-on.test.js +0 -100
  54. package/lib/rules/__tests__/prefer-strict-equal.test.js +0 -46
  55. package/lib/rules/__tests__/prefer-to-be.test.js +0 -438
  56. package/lib/rules/__tests__/prefer-to-contain.test.js +0 -301
  57. package/lib/rules/__tests__/prefer-to-have-length.test.js +0 -99
  58. package/lib/rules/__tests__/prefer-todo.test.js +0 -78
  59. package/lib/rules/__tests__/require-hook.test.js +0 -403
  60. package/lib/rules/__tests__/require-to-throw-message.test.js +0 -108
  61. package/lib/rules/__tests__/require-top-level-describe.test.js +0 -236
  62. package/lib/rules/__tests__/test-utils.js +0 -11
  63. package/lib/rules/__tests__/unbound-method.test.js +0 -518
  64. package/lib/rules/__tests__/valid-describe-callback.test.js +0 -305
  65. package/lib/rules/__tests__/valid-expect-in-promise.test.js +0 -1583
  66. package/lib/rules/__tests__/valid-expect.test.js +0 -894
  67. package/lib/rules/__tests__/valid-title.test.js +0 -1147
  68. package/lib/rules/utils/__tests__/detectJestVersion.test.js +0 -221
  69. package/lib/rules/utils/__tests__/parseJestFnCall.test.js +0 -809
@@ -1,787 +0,0 @@
1
- "use strict";
2
-
3
- var _utils = require("@typescript-eslint/utils");
4
- var _dedent = _interopRequireDefault(require("dedent"));
5
- var _noIf = _interopRequireDefault(require("../no-if"));
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('conditional expressions', _noIf.default, {
15
- valid: ['const x = y ? 1 : 0', (0, _dedent.default)`
16
- it('foo', () => {
17
- const foo = function (bar) {
18
- return foo ? bar : null;
19
- };
20
- });
21
- `, (0, _dedent.default)`
22
- it('foo', function () {
23
- const foo = function (bar) {
24
- return foo ? bar : null;
25
- };
26
- });
27
- `, (0, _dedent.default)`
28
- it.each()('foo', function () {
29
- const foo = function (bar) {
30
- return foo ? bar : null;
31
- };
32
- });
33
- `],
34
- invalid: [{
35
- code: (0, _dedent.default)`
36
- it('foo', () => {
37
- expect(bar ? foo : baz).toBe(boo);
38
- })
39
- `,
40
- errors: [{
41
- data: {
42
- condition: 'conditional'
43
- },
44
- messageId: 'conditionalInTest'
45
- }]
46
- }, {
47
- code: (0, _dedent.default)`
48
- it('foo', () => {
49
- const foo = bar ? foo : baz;
50
- })
51
- `,
52
- errors: [{
53
- data: {
54
- condition: 'conditional'
55
- },
56
- messageId: 'conditionalInTest'
57
- }]
58
- }, {
59
- code: (0, _dedent.default)`
60
- it('foo', () => {
61
- const foo = bar ? foo : baz;
62
- })
63
- const foo = bar ? foo : baz;
64
- `,
65
- errors: [{
66
- data: {
67
- condition: 'conditional'
68
- },
69
- messageId: 'conditionalInTest'
70
- }]
71
- }, {
72
- code: (0, _dedent.default)`
73
- it('foo', () => {
74
- const foo = bar ? foo : baz;
75
- const anotherFoo = anotherBar ? anotherFoo : anotherBaz;
76
- })
77
- `,
78
- errors: [{
79
- data: {
80
- condition: 'conditional'
81
- },
82
- messageId: 'conditionalInTest'
83
- }, {
84
- data: {
85
- condition: 'conditional'
86
- },
87
- messageId: 'conditionalInTest'
88
- }]
89
- }]
90
- });
91
- ruleTester.run('switch statements', _noIf.default, {
92
- valid: [(0, _dedent.default)`
93
- switch (true) {
94
- case true: {}
95
- }
96
- `, `it('foo', () => {})`, (0, _dedent.default)`
97
- it('foo', () => {});
98
- function myTest() {
99
- switch ('bar') {
100
- }
101
- }
102
- `, (0, _dedent.default)`
103
- foo('bar', () => {
104
- switch(baz) {}
105
- })
106
- `, (0, _dedent.default)`
107
- describe('foo', () => {
108
- switch('bar') {}
109
- })
110
- `, (0, _dedent.default)`
111
- describe.skip('foo', () => {
112
- switch('bar') {}
113
- })
114
- `, (0, _dedent.default)`
115
- describe.skip.each()('foo', () => {
116
- switch('bar') {}
117
- })
118
- `, (0, _dedent.default)`
119
- xdescribe('foo', () => {
120
- switch('bar') {}
121
- })
122
- `, (0, _dedent.default)`
123
- fdescribe('foo', () => {
124
- switch('bar') {}
125
- })
126
- `, (0, _dedent.default)`
127
- describe('foo', () => {
128
- switch('bar') {}
129
- })
130
- switch('bar') {}
131
- `, (0, _dedent.default)`
132
- describe('foo', () => {
133
- afterEach(() => {
134
- switch('bar') {}
135
- });
136
- });
137
- `, (0, _dedent.default)`
138
- it('valid', () => {
139
- const values = something.map(thing => {
140
- switch (thing.isFoo) {
141
- case true:
142
- return thing.foo;
143
- default:
144
- return thing.bar;
145
- }
146
- });
147
-
148
- expect(values).toStrictEqual(['foo']);
149
- });
150
- `, (0, _dedent.default)`
151
- describe('valid', () => {
152
- it('still valid', () => {
153
- const values = something.map(thing => {
154
- switch (thing.isFoo) {
155
- case true:
156
- return thing.foo;
157
- default:
158
- return thing.bar;
159
- }
160
- });
161
-
162
- expect(values).toStrictEqual(['foo']);
163
- });
164
- });
165
- `],
166
- invalid: [{
167
- code: (0, _dedent.default)`
168
- it('foo', () => {
169
- switch (true) {
170
- case true: {}
171
- }
172
- })
173
- `,
174
- errors: [{
175
- data: {
176
- condition: 'switch'
177
- },
178
- messageId: 'conditionalInTest'
179
- }]
180
- }, {
181
- code: (0, _dedent.default)`
182
- it('foo', () => {
183
- switch('bar') {}
184
- })
185
- `,
186
- errors: [{
187
- data: {
188
- condition: 'switch'
189
- },
190
- messageId: 'conditionalInTest'
191
- }]
192
- }, {
193
- code: (0, _dedent.default)`
194
- it.skip('foo', () => {
195
- switch('bar') {}
196
- })
197
- `,
198
- errors: [{
199
- data: {
200
- condition: 'switch'
201
- },
202
- messageId: 'conditionalInTest'
203
- }]
204
- }, {
205
- code: (0, _dedent.default)`
206
- it.only('foo', () => {
207
- switch('bar') {}
208
- })
209
- `,
210
- errors: [{
211
- data: {
212
- condition: 'switch'
213
- },
214
- messageId: 'conditionalInTest'
215
- }]
216
- }, {
217
- code: (0, _dedent.default)`
218
- xit('foo', () => {
219
- switch('bar') {}
220
- })
221
- `,
222
- errors: [{
223
- data: {
224
- condition: 'switch'
225
- },
226
- messageId: 'conditionalInTest'
227
- }]
228
- }, {
229
- code: (0, _dedent.default)`
230
- fit('foo', () => {
231
- switch('bar') {}
232
- })
233
- `,
234
- errors: [{
235
- data: {
236
- condition: 'switch'
237
- },
238
- messageId: 'conditionalInTest'
239
- }]
240
- }, {
241
- code: (0, _dedent.default)`
242
- fit.concurrent('foo', () => {
243
- switch('bar') {}
244
- })
245
- `,
246
- errors: [{
247
- data: {
248
- condition: 'switch'
249
- },
250
- messageId: 'conditionalInTest'
251
- }]
252
- }, {
253
- code: (0, _dedent.default)`
254
- test('foo', () => {
255
- switch('bar') {}
256
- })
257
- `,
258
- errors: [{
259
- data: {
260
- condition: 'switch'
261
- },
262
- messageId: 'conditionalInTest'
263
- }]
264
- }, {
265
- code: (0, _dedent.default)`
266
- test.skip('foo', () => {
267
- switch('bar') {}
268
- })
269
- `,
270
- errors: [{
271
- data: {
272
- condition: 'switch'
273
- },
274
- messageId: 'conditionalInTest'
275
- }]
276
- }, {
277
- code: (0, _dedent.default)`
278
- test.only('foo', () => {
279
- switch('bar') {}
280
- })
281
- `,
282
- errors: [{
283
- data: {
284
- condition: 'switch'
285
- },
286
- messageId: 'conditionalInTest'
287
- }]
288
- }, {
289
- code: (0, _dedent.default)`
290
- xtest('foo', () => {
291
- switch('bar') {}
292
- })
293
- `,
294
- errors: [{
295
- data: {
296
- condition: 'switch'
297
- },
298
- messageId: 'conditionalInTest'
299
- }]
300
- }, {
301
- code: (0, _dedent.default)`
302
- xtest('foo', function () {
303
- switch('bar') {}
304
- })
305
- `,
306
- errors: [{
307
- data: {
308
- condition: 'switch'
309
- },
310
- messageId: 'conditionalInTest'
311
- }]
312
- }, {
313
- code: (0, _dedent.default)`
314
- describe('foo', () => {
315
- it('bar', () => {
316
-
317
- switch('bar') {}
318
- })
319
- })
320
- `,
321
- errors: [{
322
- data: {
323
- condition: 'switch'
324
- },
325
- messageId: 'conditionalInTest'
326
- }]
327
- }, {
328
- code: "it('foo', myTest); function myTest() { switch ('bar') {} }",
329
- errors: [{
330
- data: {
331
- condition: 'switch'
332
- },
333
- messageId: 'conditionalInTest'
334
- }]
335
- }, {
336
- code: (0, _dedent.default)`
337
- describe('foo', () => {
338
- it('bar', () => {
339
- switch('bar') {}
340
- })
341
- it('baz', () => {
342
- switch('qux') {}
343
- switch('quux') {}
344
- })
345
- })
346
- `,
347
- errors: [{
348
- data: {
349
- condition: 'switch'
350
- },
351
- messageId: 'conditionalInTest'
352
- }, {
353
- data: {
354
- condition: 'switch'
355
- },
356
- messageId: 'conditionalInTest'
357
- }, {
358
- data: {
359
- condition: 'switch'
360
- },
361
- messageId: 'conditionalInTest'
362
- }]
363
- }, {
364
- code: (0, _dedent.default)`
365
- it('foo', () => {
366
- callExpression()
367
- switch ('bar') {}
368
- })
369
- `,
370
- errors: [{
371
- data: {
372
- condition: 'switch'
373
- },
374
- messageId: 'conditionalInTest'
375
- }]
376
- }, {
377
- code: (0, _dedent.default)`
378
- describe('valid', () => {
379
- describe('still valid', () => {
380
- it('really still valid', () => {
381
- const values = something.map((thing) => {
382
- switch (thing.isFoo) {
383
- case true:
384
- return thing.foo;
385
- default:
386
- return thing.bar;
387
- }
388
- });
389
-
390
- switch('invalid') {
391
- case true:
392
- expect(values).toStrictEqual(['foo']);
393
- }
394
- });
395
- });
396
- });
397
- `,
398
- errors: [{
399
- data: {
400
- condition: 'switch'
401
- },
402
- messageId: 'conditionalInTest'
403
- }]
404
- }]
405
- });
406
- ruleTester.run('if statements', _noIf.default, {
407
- valid: ['if(foo) {}', "it('foo', () => {})", 'it("foo", function () {})', "it('foo', () => {}); function myTest() { if('bar') {} }", (0, _dedent.default)`
408
- foo('bar', () => {
409
- if(baz) {}
410
- })
411
- `, (0, _dedent.default)`
412
- describe('foo', () => {
413
- if('bar') {}
414
- })
415
- `, (0, _dedent.default)`
416
- describe.skip('foo', () => {
417
- if('bar') {}
418
- })
419
- `, (0, _dedent.default)`
420
- xdescribe('foo', () => {
421
- if('bar') {}
422
- })
423
- `, (0, _dedent.default)`
424
- fdescribe('foo', () => {
425
- if('bar') {}
426
- })
427
- `, (0, _dedent.default)`
428
- describe('foo', () => {
429
- if('bar') {}
430
- })
431
- if('baz') {}
432
- `, (0, _dedent.default)`
433
- describe('foo', () => {
434
- afterEach(() => {
435
- if('bar') {}
436
- });
437
- })
438
- `, (0, _dedent.default)`
439
- describe.each\`\`('foo', () => {
440
- afterEach(() => {
441
- if('bar') {}
442
- });
443
- })
444
- `, (0, _dedent.default)`
445
- describe('foo', () => {
446
- beforeEach(() => {
447
- if('bar') {}
448
- });
449
- })
450
- `, 'const foo = bar ? foo : baz;', (0, _dedent.default)`
451
- it('valid', () => {
452
- const values = something.map((thing) => {
453
- if (thing.isFoo) {
454
- return thing.foo
455
- } else {
456
- return thing.bar;
457
- }
458
- });
459
-
460
- expect(values).toStrictEqual(['foo']);
461
- });
462
- `, (0, _dedent.default)`
463
- describe('valid', () => {
464
- it('still valid', () => {
465
- const values = something.map((thing) => {
466
- if (thing.isFoo) {
467
- return thing.foo
468
- } else {
469
- return thing.bar;
470
- }
471
- });
472
-
473
- expect(values).toStrictEqual(['foo']);
474
- });
475
- });
476
- `, (0, _dedent.default)`
477
- describe('valid', () => {
478
- describe('still valid', () => {
479
- it('really still valid', () => {
480
- const values = something.map((thing) => {
481
- if (thing.isFoo) {
482
- return thing.foo
483
- } else {
484
- return thing.bar;
485
- }
486
- });
487
-
488
- expect(values).toStrictEqual(['foo']);
489
- });
490
- });
491
- });
492
- `, (0, _dedent.default)`
493
- it('foo', () => {
494
- const foo = function(bar) {
495
- if (bar) {
496
- return 1;
497
- } else {
498
- return 2;
499
- }
500
- };
501
- });
502
- `, (0, _dedent.default)`
503
- it('foo', () => {
504
- function foo(bar) {
505
- if (bar) {
506
- return 1;
507
- } else {
508
- return 2;
509
- }
510
- };
511
- });
512
- `],
513
- invalid: [{
514
- code: (0, _dedent.default)`
515
- it('foo', () => {
516
- if('bar') {}
517
- })
518
- `,
519
- errors: [{
520
- data: {
521
- condition: 'if'
522
- },
523
- messageId: 'conditionalInTest'
524
- }]
525
- }, {
526
- code: (0, _dedent.default)`
527
- it.skip('foo', () => {
528
- if('bar') {}
529
- })
530
- `,
531
- errors: [{
532
- data: {
533
- condition: 'if'
534
- },
535
- messageId: 'conditionalInTest'
536
- }]
537
- }, {
538
- code: (0, _dedent.default)`
539
- it.skip('foo', function () {
540
- if('bar') {}
541
- })
542
- `,
543
- errors: [{
544
- data: {
545
- condition: 'if'
546
- },
547
- messageId: 'conditionalInTest'
548
- }]
549
- }, {
550
- code: (0, _dedent.default)`
551
- it.only('foo', () => {
552
- if('bar') {}
553
- })
554
- `,
555
- errors: [{
556
- data: {
557
- condition: 'if'
558
- },
559
- messageId: 'conditionalInTest'
560
- }]
561
- }, {
562
- code: (0, _dedent.default)`
563
- xit('foo', () => {
564
- if('bar') {}
565
- })
566
- `,
567
- errors: [{
568
- data: {
569
- condition: 'if'
570
- },
571
- messageId: 'conditionalInTest'
572
- }]
573
- }, {
574
- code: (0, _dedent.default)`
575
- fit('foo', () => {
576
- if('bar') {}
577
- })
578
- `,
579
- errors: [{
580
- data: {
581
- condition: 'if'
582
- },
583
- messageId: 'conditionalInTest'
584
- }]
585
- }, {
586
- code: (0, _dedent.default)`
587
- fit.concurrent('foo', () => {
588
- if('bar') {}
589
- })
590
- `,
591
- errors: [{
592
- data: {
593
- condition: 'if'
594
- },
595
- messageId: 'conditionalInTest'
596
- }]
597
- }, {
598
- code: (0, _dedent.default)`
599
- test('foo', () => {
600
- if('bar') {}
601
- })
602
- `,
603
- errors: [{
604
- data: {
605
- condition: 'if'
606
- },
607
- messageId: 'conditionalInTest'
608
- }]
609
- }, {
610
- code: (0, _dedent.default)`
611
- test.skip('foo', () => {
612
- if('bar') {}
613
- })
614
- `,
615
- errors: [{
616
- data: {
617
- condition: 'if'
618
- },
619
- messageId: 'conditionalInTest'
620
- }]
621
- }, {
622
- code: (0, _dedent.default)`
623
- test.only('foo', () => {
624
- if('bar') {}
625
- })
626
- `,
627
- errors: [{
628
- data: {
629
- condition: 'if'
630
- },
631
- messageId: 'conditionalInTest'
632
- }]
633
- }, {
634
- code: (0, _dedent.default)`
635
- xtest('foo', () => {
636
- if('bar') {}
637
- })
638
- `,
639
- errors: [{
640
- data: {
641
- condition: 'if'
642
- },
643
- messageId: 'conditionalInTest'
644
- }]
645
- }, {
646
- code: (0, _dedent.default)`
647
- describe('foo', () => {
648
- it('bar', () => {
649
- if('bar') {}
650
- })
651
- })
652
- `,
653
- errors: [{
654
- data: {
655
- condition: 'if'
656
- },
657
- messageId: 'conditionalInTest'
658
- }]
659
- }, {
660
- code: "it('foo', myTest); function myTest() { if ('bar') {} }",
661
- errors: [{
662
- data: {
663
- condition: 'if'
664
- },
665
- messageId: 'conditionalInTest'
666
- }]
667
- }, {
668
- code: (0, _dedent.default)`
669
- describe('foo', () => {
670
- it('bar', () => {
671
- if('bar') {}
672
- })
673
- it('baz', () => {
674
- if('qux') {}
675
- if('quux') {}
676
- })
677
- })
678
- `,
679
- errors: [{
680
- data: {
681
- condition: 'if'
682
- },
683
- messageId: 'conditionalInTest'
684
- }, {
685
- data: {
686
- condition: 'if'
687
- },
688
- messageId: 'conditionalInTest'
689
- }, {
690
- data: {
691
- condition: 'if'
692
- },
693
- messageId: 'conditionalInTest'
694
- }]
695
- }, {
696
- code: (0, _dedent.default)`
697
- it('foo', () => {
698
- callExpression()
699
- if ('bar') {}
700
- })
701
- `,
702
- errors: [{
703
- data: {
704
- condition: 'if'
705
- },
706
- messageId: 'conditionalInTest'
707
- }]
708
- }, {
709
- code: (0, _dedent.default)`
710
- it.each\`\`('foo', () => {
711
- callExpression()
712
- if ('bar') {}
713
- })
714
- `,
715
- errors: [{
716
- data: {
717
- condition: 'if'
718
- },
719
- messageId: 'conditionalInTest'
720
- }]
721
- }, {
722
- code: (0, _dedent.default)`
723
- it.each()('foo', () => {
724
- callExpression()
725
- if ('bar') {}
726
- })
727
- `,
728
- errors: [{
729
- data: {
730
- condition: 'if'
731
- },
732
- messageId: 'conditionalInTest'
733
- }]
734
- }, {
735
- code: (0, _dedent.default)`
736
- it.only.each\`\`('foo', () => {
737
- callExpression()
738
- if ('bar') {}
739
- })
740
- `,
741
- errors: [{
742
- data: {
743
- condition: 'if'
744
- },
745
- messageId: 'conditionalInTest'
746
- }]
747
- }, {
748
- code: (0, _dedent.default)`
749
- it.only.each()('foo', () => {
750
- callExpression()
751
- if ('bar') {}
752
- })
753
- `,
754
- errors: [{
755
- data: {
756
- condition: 'if'
757
- },
758
- messageId: 'conditionalInTest'
759
- }]
760
- }, {
761
- code: (0, _dedent.default)`
762
- describe('valid', () => {
763
- describe('still valid', () => {
764
- it('really still valid', () => {
765
- const values = something.map((thing) => {
766
- if (thing.isFoo) {
767
- return thing.foo
768
- } else {
769
- return thing.bar;
770
- }
771
- });
772
-
773
- if('invalid') {
774
- expect(values).toStrictEqual(['foo']);
775
- }
776
- });
777
- });
778
- });
779
- `,
780
- errors: [{
781
- data: {
782
- condition: 'if'
783
- },
784
- messageId: 'conditionalInTest'
785
- }]
786
- }]
787
- });