Skip to content

Commit 0aa5eb6

Browse files
authored
fix: don't consider concurrent.skip and concurrent.only valid test functions (#1124)
1 parent b67e389 commit 0aa5eb6

9 files changed

+25
-171
lines changed

src/rules/__tests__/no-conditional-in-test.test.ts

+4-60
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,6 @@ ruleTester.run('switch statements', rule, {
276276
},
277277
],
278278
},
279-
{
280-
code: dedent`
281-
it.concurrent.skip('foo', () => {
282-
switch('bar') {}
283-
})
284-
`,
285-
errors: [
286-
{
287-
messageId: 'conditionalInTest',
288-
column: 3,
289-
line: 2,
290-
},
291-
],
292-
},
293279
{
294280
code: dedent`
295281
it.only('foo', () => {
@@ -304,20 +290,6 @@ ruleTester.run('switch statements', rule, {
304290
},
305291
],
306292
},
307-
{
308-
code: dedent`
309-
it.concurrent.only('foo', () => {
310-
switch('bar') {}
311-
})
312-
`,
313-
errors: [
314-
{
315-
messageId: 'conditionalInTest',
316-
column: 3,
317-
line: 2,
318-
},
319-
],
320-
},
321293
{
322294
code: dedent`
323295
xit('foo', () => {
@@ -362,7 +334,7 @@ ruleTester.run('switch statements', rule, {
362334
},
363335
{
364336
code: dedent`
365-
test.concurrent.skip('foo', () => {
337+
test.skip('foo', () => {
366338
switch('bar') {}
367339
})
368340
`,
@@ -376,7 +348,7 @@ ruleTester.run('switch statements', rule, {
376348
},
377349
{
378350
code: dedent`
379-
test.concurrent.only('foo', () => {
351+
test.only('foo', () => {
380352
switch('bar') {}
381353
})
382354
`,
@@ -696,20 +668,6 @@ ruleTester.run('if statements', rule, {
696668
},
697669
],
698670
},
699-
{
700-
code: dedent`
701-
it.concurrent.skip('foo', () => {
702-
if ('bar') {}
703-
})
704-
`,
705-
errors: [
706-
{
707-
messageId: 'conditionalInTest',
708-
column: 3,
709-
line: 2,
710-
},
711-
],
712-
},
713671
{
714672
code: dedent`
715673
it.only('foo', () => {
@@ -724,20 +682,6 @@ ruleTester.run('if statements', rule, {
724682
},
725683
],
726684
},
727-
{
728-
code: dedent`
729-
it.concurrent.only('foo', () => {
730-
if ('bar') {}
731-
})
732-
`,
733-
errors: [
734-
{
735-
messageId: 'conditionalInTest',
736-
column: 3,
737-
line: 2,
738-
},
739-
],
740-
},
741685
{
742686
code: dedent`
743687
xit('foo', () => {
@@ -782,7 +726,7 @@ ruleTester.run('if statements', rule, {
782726
},
783727
{
784728
code: dedent`
785-
test.concurrent.skip('foo', () => {
729+
test.skip('foo', () => {
786730
if ('bar') {}
787731
})
788732
`,
@@ -796,7 +740,7 @@ ruleTester.run('if statements', rule, {
796740
},
797741
{
798742
code: dedent`
799-
test.concurrent.only('foo', () => {
743+
test.only('foo', () => {
800744
if ('bar') {}
801745
})
802746
`,

src/rules/__tests__/no-disabled-tests.test.ts

-8
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ ruleTester.run('no-disabled-tests', rule, {
9595
code: 'it.skip("foo", function () {})',
9696
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
9797
},
98-
{
99-
code: 'it.concurrent.skip("foo", function () {})',
100-
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
101-
},
10298
{
10399
code: 'it["skip"]("foo", function () {})',
104100
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
@@ -123,10 +119,6 @@ ruleTester.run('no-disabled-tests', rule, {
123119
code: 'test.skip.each([])("foo", function () {})',
124120
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
125121
},
126-
{
127-
code: 'test.concurrent.skip("foo", function () {})',
128-
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
129-
},
130122
{
131123
code: 'test["skip"]("foo", function () {})',
132124
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],

src/rules/__tests__/no-focused-tests.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ ruleTester.run('no-focused-tests', rule, {
1616
'it()',
1717
'describe.skip()',
1818
'it.skip()',
19-
'it.concurrent.skip()',
2019
'test()',
2120
'test.skip()',
22-
'test.concurrent.skip()',
2321
'var appliedOnly = describe.only; appliedOnly.apply(describe)',
2422
'var calledOnly = it.only; calledOnly.call(it)',
2523
'it.each()()',
@@ -111,7 +109,7 @@ ruleTester.run('no-focused-tests', rule, {
111109
],
112110
},
113111
{
114-
code: 'it.concurrent.only()',
112+
code: 'it.concurrent.only.each``()',
115113
errors: [
116114
{
117115
messageId: 'focusedTest',
@@ -120,7 +118,7 @@ ruleTester.run('no-focused-tests', rule, {
120118
suggestions: [
121119
{
122120
messageId: 'suggestRemoveFocus',
123-
output: 'it.concurrent()',
121+
output: 'it.concurrent.each``()',
124122
},
125123
],
126124
},
@@ -191,7 +189,7 @@ ruleTester.run('no-focused-tests', rule, {
191189
],
192190
},
193191
{
194-
code: 'test.concurrent.only()',
192+
code: 'test.concurrent.only.each()()',
195193
errors: [
196194
{
197195
messageId: 'focusedTest',
@@ -200,7 +198,7 @@ ruleTester.run('no-focused-tests', rule, {
200198
suggestions: [
201199
{
202200
messageId: 'suggestRemoveFocus',
203-
output: 'test.concurrent()',
201+
output: 'test.concurrent.each()()',
204202
},
205203
],
206204
},

src/rules/__tests__/no-identical-title.test.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ ruleTester.run('no-identical-title', rule, {
5959
test.only.concurrent('that', () => {});
6060
`,
6161
dedent`
62-
test.concurrent.only('this', () => {});
63-
test.concurrent.only('that', () => {});
62+
test.only('this', () => {});
63+
test.only('that', () => {});
6464
`,
6565
dedent`
6666
describe('foo', () => {
@@ -199,18 +199,11 @@ ruleTester.run('no-identical-title', rule, {
199199
},
200200
{
201201
code: dedent`
202-
test.concurrent.only('this', () => {});
202+
test.only('this', () => {});
203203
test.concurrent('this', () => {});
204204
`,
205205
errors: [{ messageId: 'multipleTestTitle', column: 17, line: 2 }],
206206
},
207-
{
208-
code: dedent`
209-
test.concurrent.only('this', () => {});
210-
test.concurrent.only('this', () => {});
211-
`,
212-
errors: [{ messageId: 'multipleTestTitle', column: 22, line: 2 }],
213-
},
214207
{
215208
code: dedent`
216209
describe('foo', () => {});

src/rules/__tests__/no-if.test.ts

+4-56
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,6 @@ ruleTester.run('switch statements', rule, {
228228
},
229229
],
230230
},
231-
{
232-
code: dedent`
233-
it.concurrent.skip('foo', () => {
234-
switch('bar') {}
235-
})
236-
`,
237-
errors: [
238-
{
239-
data: { condition: 'switch' },
240-
messageId: 'conditionalInTest',
241-
},
242-
],
243-
},
244231
{
245232
code: dedent`
246233
it.only('foo', () => {
@@ -254,19 +241,6 @@ ruleTester.run('switch statements', rule, {
254241
},
255242
],
256243
},
257-
{
258-
code: dedent`
259-
it.concurrent.only('foo', () => {
260-
switch('bar') {}
261-
})
262-
`,
263-
errors: [
264-
{
265-
data: { condition: 'switch' },
266-
messageId: 'conditionalInTest',
267-
},
268-
],
269-
},
270244
{
271245
code: dedent`
272246
xit('foo', () => {
@@ -321,7 +295,7 @@ ruleTester.run('switch statements', rule, {
321295
},
322296
{
323297
code: dedent`
324-
test.concurrent.skip('foo', () => {
298+
test.skip('foo', () => {
325299
switch('bar') {}
326300
})
327301
`,
@@ -334,7 +308,7 @@ ruleTester.run('switch statements', rule, {
334308
},
335309
{
336310
code: dedent`
337-
test.concurrent.only('foo', () => {
311+
test.only('foo', () => {
338312
switch('bar') {}
339313
})
340314
`,
@@ -636,19 +610,6 @@ ruleTester.run('if statements', rule, {
636610
},
637611
],
638612
},
639-
{
640-
code: dedent`
641-
it.concurrent.skip('foo', () => {
642-
if('bar') {}
643-
})
644-
`,
645-
errors: [
646-
{
647-
data: { condition: 'if' },
648-
messageId: 'conditionalInTest',
649-
},
650-
],
651-
},
652613
{
653614
code: dedent`
654615
it.only('foo', () => {
@@ -662,19 +623,6 @@ ruleTester.run('if statements', rule, {
662623
},
663624
],
664625
},
665-
{
666-
code: dedent`
667-
it.concurrent.only('foo', () => {
668-
if('bar') {}
669-
})
670-
`,
671-
errors: [
672-
{
673-
data: { condition: 'if' },
674-
messageId: 'conditionalInTest',
675-
},
676-
],
677-
},
678626
{
679627
code: dedent`
680628
xit('foo', () => {
@@ -729,7 +677,7 @@ ruleTester.run('if statements', rule, {
729677
},
730678
{
731679
code: dedent`
732-
test.concurrent.skip('foo', () => {
680+
test.skip('foo', () => {
733681
if('bar') {}
734682
})
735683
`,
@@ -742,7 +690,7 @@ ruleTester.run('if statements', rule, {
742690
},
743691
{
744692
code: dedent`
745-
test.concurrent.only('foo', () => {
693+
test.only('foo', () => {
746694
if('bar') {}
747695
})
748696
`,

src/rules/__tests__/no-test-prefixes.test.ts

-4
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ ruleTester.run('no-test-prefixes', rule, {
1818
code: 'it.each``("foo", function () {})',
1919
parserOptions: { ecmaVersion: 6 },
2020
},
21-
'it.concurrent.only("foo", function () {})',
2221
'test.only("foo", function () {})',
2322
'test.each()("foo", function () {})',
2423
{
2524
code: 'test.each``("foo", function () {})',
2625
parserOptions: { ecmaVersion: 6 },
2726
},
28-
'test.concurrent.only("foo", function () {})',
2927
'describe.skip("foo", function () {})',
3028
'it.skip("foo", function () {})',
31-
'it.concurrent.skip("foo", function () {})',
3229
'test.skip("foo", function () {})',
33-
'test.concurrent.skip("foo", function () {})',
3430
'foo()',
3531
'[1,2,3].forEach()',
3632
],

src/rules/__tests__/valid-title.test.ts

+6-17
Original file line numberDiff line numberDiff line change
@@ -612,17 +612,6 @@ ruleTester.run('title-must-be-string', rule, {
612612
},
613613
],
614614
},
615-
{
616-
code: 'test.concurrent.skip(123, () => {});',
617-
options: [{ ignoreTypeOfDescribeName: true }],
618-
errors: [
619-
{
620-
messageId: 'titleMustBeString',
621-
column: 22,
622-
line: 1,
623-
},
624-
],
625-
},
626615
{
627616
code: 'describe(String(/.+/), () => {});',
628617
errors: [
@@ -917,19 +906,19 @@ ruleTester.run('no-accidental-space', rule, {
917906
errors: [{ messageId: 'accidentalSpace', column: 5, line: 1 }],
918907
},
919908
{
920-
code: 'it.concurrent.skip(" foo", function () {})',
921-
output: 'it.concurrent.skip("foo", function () {})',
922-
errors: [{ messageId: 'accidentalSpace', column: 20, line: 1 }],
909+
code: 'it.skip(" foo", function () {})',
910+
output: 'it.skip("foo", function () {})',
911+
errors: [{ messageId: 'accidentalSpace', column: 9, line: 1 }],
923912
},
924913
{
925914
code: 'fit("foo ", function () {})',
926915
output: 'fit("foo", function () {})',
927916
errors: [{ messageId: 'accidentalSpace', column: 5, line: 1 }],
928917
},
929918
{
930-
code: 'it.concurrent.skip("foo ", function () {})',
931-
output: 'it.concurrent.skip("foo", function () {})',
932-
errors: [{ messageId: 'accidentalSpace', column: 20, line: 1 }],
919+
code: 'it.skip("foo ", function () {})',
920+
output: 'it.skip("foo", function () {})',
921+
errors: [{ messageId: 'accidentalSpace', column: 9, line: 1 }],
933922
},
934923
{
935924
code: dedent`

0 commit comments

Comments
 (0)