Skip to content

Commit

Permalink
fix: don't consider concurrent.skip and concurrent.only valid tes…
Browse files Browse the repository at this point in the history
…t functions (#1124)
  • Loading branch information
G-Rath committed May 28, 2022
1 parent b67e389 commit 0aa5eb6
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 171 deletions.
64 changes: 4 additions & 60 deletions src/rules/__tests__/no-conditional-in-test.test.ts
Expand Up @@ -276,20 +276,6 @@ ruleTester.run('switch statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.skip('foo', () => {
switch('bar') {}
})
`,
errors: [
{
messageId: 'conditionalInTest',
column: 3,
line: 2,
},
],
},
{
code: dedent`
it.only('foo', () => {
Expand All @@ -304,20 +290,6 @@ ruleTester.run('switch statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.only('foo', () => {
switch('bar') {}
})
`,
errors: [
{
messageId: 'conditionalInTest',
column: 3,
line: 2,
},
],
},
{
code: dedent`
xit('foo', () => {
Expand Down Expand Up @@ -362,7 +334,7 @@ ruleTester.run('switch statements', rule, {
},
{
code: dedent`
test.concurrent.skip('foo', () => {
test.skip('foo', () => {
switch('bar') {}
})
`,
Expand All @@ -376,7 +348,7 @@ ruleTester.run('switch statements', rule, {
},
{
code: dedent`
test.concurrent.only('foo', () => {
test.only('foo', () => {
switch('bar') {}
})
`,
Expand Down Expand Up @@ -696,20 +668,6 @@ ruleTester.run('if statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.skip('foo', () => {
if ('bar') {}
})
`,
errors: [
{
messageId: 'conditionalInTest',
column: 3,
line: 2,
},
],
},
{
code: dedent`
it.only('foo', () => {
Expand All @@ -724,20 +682,6 @@ ruleTester.run('if statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.only('foo', () => {
if ('bar') {}
})
`,
errors: [
{
messageId: 'conditionalInTest',
column: 3,
line: 2,
},
],
},
{
code: dedent`
xit('foo', () => {
Expand Down Expand Up @@ -782,7 +726,7 @@ ruleTester.run('if statements', rule, {
},
{
code: dedent`
test.concurrent.skip('foo', () => {
test.skip('foo', () => {
if ('bar') {}
})
`,
Expand All @@ -796,7 +740,7 @@ ruleTester.run('if statements', rule, {
},
{
code: dedent`
test.concurrent.only('foo', () => {
test.only('foo', () => {
if ('bar') {}
})
`,
Expand Down
8 changes: 0 additions & 8 deletions src/rules/__tests__/no-disabled-tests.test.ts
Expand Up @@ -95,10 +95,6 @@ ruleTester.run('no-disabled-tests', rule, {
code: 'it.skip("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
},
{
code: 'it.concurrent.skip("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
},
{
code: 'it["skip"]("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
Expand All @@ -123,10 +119,6 @@ ruleTester.run('no-disabled-tests', rule, {
code: 'test.skip.each([])("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
},
{
code: 'test.concurrent.skip("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
},
{
code: 'test["skip"]("foo", function () {})',
errors: [{ messageId: 'disabledTest', column: 1, line: 1 }],
Expand Down
10 changes: 4 additions & 6 deletions src/rules/__tests__/no-focused-tests.test.ts
Expand Up @@ -16,10 +16,8 @@ ruleTester.run('no-focused-tests', rule, {
'it()',
'describe.skip()',
'it.skip()',
'it.concurrent.skip()',
'test()',
'test.skip()',
'test.concurrent.skip()',
'var appliedOnly = describe.only; appliedOnly.apply(describe)',
'var calledOnly = it.only; calledOnly.call(it)',
'it.each()()',
Expand Down Expand Up @@ -111,7 +109,7 @@ ruleTester.run('no-focused-tests', rule, {
],
},
{
code: 'it.concurrent.only()',
code: 'it.concurrent.only.each``()',
errors: [
{
messageId: 'focusedTest',
Expand All @@ -120,7 +118,7 @@ ruleTester.run('no-focused-tests', rule, {
suggestions: [
{
messageId: 'suggestRemoveFocus',
output: 'it.concurrent()',
output: 'it.concurrent.each``()',
},
],
},
Expand Down Expand Up @@ -191,7 +189,7 @@ ruleTester.run('no-focused-tests', rule, {
],
},
{
code: 'test.concurrent.only()',
code: 'test.concurrent.only.each()()',
errors: [
{
messageId: 'focusedTest',
Expand All @@ -200,7 +198,7 @@ ruleTester.run('no-focused-tests', rule, {
suggestions: [
{
messageId: 'suggestRemoveFocus',
output: 'test.concurrent()',
output: 'test.concurrent.each()()',
},
],
},
Expand Down
13 changes: 3 additions & 10 deletions src/rules/__tests__/no-identical-title.test.ts
Expand Up @@ -59,8 +59,8 @@ ruleTester.run('no-identical-title', rule, {
test.only.concurrent('that', () => {});
`,
dedent`
test.concurrent.only('this', () => {});
test.concurrent.only('that', () => {});
test.only('this', () => {});
test.only('that', () => {});
`,
dedent`
describe('foo', () => {
Expand Down Expand Up @@ -199,18 +199,11 @@ ruleTester.run('no-identical-title', rule, {
},
{
code: dedent`
test.concurrent.only('this', () => {});
test.only('this', () => {});
test.concurrent('this', () => {});
`,
errors: [{ messageId: 'multipleTestTitle', column: 17, line: 2 }],
},
{
code: dedent`
test.concurrent.only('this', () => {});
test.concurrent.only('this', () => {});
`,
errors: [{ messageId: 'multipleTestTitle', column: 22, line: 2 }],
},
{
code: dedent`
describe('foo', () => {});
Expand Down
60 changes: 4 additions & 56 deletions src/rules/__tests__/no-if.test.ts
Expand Up @@ -228,19 +228,6 @@ ruleTester.run('switch statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.skip('foo', () => {
switch('bar') {}
})
`,
errors: [
{
data: { condition: 'switch' },
messageId: 'conditionalInTest',
},
],
},
{
code: dedent`
it.only('foo', () => {
Expand All @@ -254,19 +241,6 @@ ruleTester.run('switch statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.only('foo', () => {
switch('bar') {}
})
`,
errors: [
{
data: { condition: 'switch' },
messageId: 'conditionalInTest',
},
],
},
{
code: dedent`
xit('foo', () => {
Expand Down Expand Up @@ -321,7 +295,7 @@ ruleTester.run('switch statements', rule, {
},
{
code: dedent`
test.concurrent.skip('foo', () => {
test.skip('foo', () => {
switch('bar') {}
})
`,
Expand All @@ -334,7 +308,7 @@ ruleTester.run('switch statements', rule, {
},
{
code: dedent`
test.concurrent.only('foo', () => {
test.only('foo', () => {
switch('bar') {}
})
`,
Expand Down Expand Up @@ -636,19 +610,6 @@ ruleTester.run('if statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.skip('foo', () => {
if('bar') {}
})
`,
errors: [
{
data: { condition: 'if' },
messageId: 'conditionalInTest',
},
],
},
{
code: dedent`
it.only('foo', () => {
Expand All @@ -662,19 +623,6 @@ ruleTester.run('if statements', rule, {
},
],
},
{
code: dedent`
it.concurrent.only('foo', () => {
if('bar') {}
})
`,
errors: [
{
data: { condition: 'if' },
messageId: 'conditionalInTest',
},
],
},
{
code: dedent`
xit('foo', () => {
Expand Down Expand Up @@ -729,7 +677,7 @@ ruleTester.run('if statements', rule, {
},
{
code: dedent`
test.concurrent.skip('foo', () => {
test.skip('foo', () => {
if('bar') {}
})
`,
Expand All @@ -742,7 +690,7 @@ ruleTester.run('if statements', rule, {
},
{
code: dedent`
test.concurrent.only('foo', () => {
test.only('foo', () => {
if('bar') {}
})
`,
Expand Down
4 changes: 0 additions & 4 deletions src/rules/__tests__/no-test-prefixes.test.ts
Expand Up @@ -18,19 +18,15 @@ ruleTester.run('no-test-prefixes', rule, {
code: 'it.each``("foo", function () {})',
parserOptions: { ecmaVersion: 6 },
},
'it.concurrent.only("foo", function () {})',
'test.only("foo", function () {})',
'test.each()("foo", function () {})',
{
code: 'test.each``("foo", function () {})',
parserOptions: { ecmaVersion: 6 },
},
'test.concurrent.only("foo", function () {})',
'describe.skip("foo", function () {})',
'it.skip("foo", function () {})',
'it.concurrent.skip("foo", function () {})',
'test.skip("foo", function () {})',
'test.concurrent.skip("foo", function () {})',
'foo()',
'[1,2,3].forEach()',
],
Expand Down
23 changes: 6 additions & 17 deletions src/rules/__tests__/valid-title.test.ts
Expand Up @@ -612,17 +612,6 @@ ruleTester.run('title-must-be-string', rule, {
},
],
},
{
code: 'test.concurrent.skip(123, () => {});',
options: [{ ignoreTypeOfDescribeName: true }],
errors: [
{
messageId: 'titleMustBeString',
column: 22,
line: 1,
},
],
},
{
code: 'describe(String(/.+/), () => {});',
errors: [
Expand Down Expand Up @@ -917,19 +906,19 @@ ruleTester.run('no-accidental-space', rule, {
errors: [{ messageId: 'accidentalSpace', column: 5, line: 1 }],
},
{
code: 'it.concurrent.skip(" foo", function () {})',
output: 'it.concurrent.skip("foo", function () {})',
errors: [{ messageId: 'accidentalSpace', column: 20, line: 1 }],
code: 'it.skip(" foo", function () {})',
output: 'it.skip("foo", function () {})',
errors: [{ messageId: 'accidentalSpace', column: 9, line: 1 }],
},
{
code: 'fit("foo ", function () {})',
output: 'fit("foo", function () {})',
errors: [{ messageId: 'accidentalSpace', column: 5, line: 1 }],
},
{
code: 'it.concurrent.skip("foo ", function () {})',
output: 'it.concurrent.skip("foo", function () {})',
errors: [{ messageId: 'accidentalSpace', column: 20, line: 1 }],
code: 'it.skip("foo ", function () {})',
output: 'it.skip("foo", function () {})',
errors: [{ messageId: 'accidentalSpace', column: 9, line: 1 }],
},
{
code: dedent`
Expand Down

0 comments on commit 0aa5eb6

Please sign in to comment.