Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Remove Describe from jest/no-if (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Seccafien authored Apr 9, 2019
1 parent d73fc5f commit a603711
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 63 deletions.
7 changes: 3 additions & 4 deletions lib/rules/jest/no-if.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const {docsUrl} = require('../../utilities');
const {
TEST_FUNCTION_NAMES,
getTestMethodName,
} = require('../../utilities/jest');
const {getTestMethodName} = require('../../utilities/jest');

const TEST_FUNCTION_NAMES = ['it', 'xit', 'fit', 'test', 'xtest'];

module.exports = {
meta: {
Expand Down
90 changes: 39 additions & 51 deletions tests/lib/rules/jest/no-if.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,66 @@ ruleTester.run('no-if', rule, {
})`,
parser,
},
],
invalid: [
{
code: `it('foo', () => {
code: `describe('foo', () => {
if('bar') {}
})`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `it.skip('foo', () => {
code: `describe.skip('foo', () => {
if('bar') {}
})`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `it.only('foo', () => {
code: `describe('foo', () => {
if('bar') {}
})`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `xit('foo', () => {
code: `xdescribe('foo', () => {
if('bar') {}
})`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `fit('foo', () => {
if('bar') {}
})`,
code: `fdescribe('foo', () => {
if('bar') {}
})`,
parser,
},
{
code: `describe('foo', () => {
if('bar') {}
})
if('baz') {}
`,
parser,
},
{
code: `describe('foo', () => {
afterEach(() => {
if('bar') {}
});
})
`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `describe('foo', () => {
beforeEach(() => {
if('bar') {}
});
})
`,
parser,
},
],
invalid: [
{
code: `it('foo', () => {
if('bar') {}
})`,
parser,
Expand All @@ -89,7 +90,7 @@ ruleTester.run('no-if', rule, {
],
},
{
code: `describe.skip('foo', () => {
code: `it.skip('foo', () => {
if('bar') {}
})`,
parser,
Expand All @@ -100,7 +101,7 @@ ruleTester.run('no-if', rule, {
],
},
{
code: `describe.only('foo', () => {
code: `it.only('foo', () => {
if('bar') {}
})`,
parser,
Expand All @@ -111,7 +112,7 @@ ruleTester.run('no-if', rule, {
],
},
{
code: `xdescribe.only('foo', () => {
code: `xit('foo', () => {
if('bar') {}
})`,
parser,
Expand All @@ -122,7 +123,7 @@ ruleTester.run('no-if', rule, {
],
},
{
code: `fdescribe.only('foo', () => {
code: `fit('foo', () => {
if('bar') {}
})`,
parser,
Expand Down Expand Up @@ -212,19 +213,6 @@ ruleTester.run('no-if', rule, {
},
],
},
{
code: `describe('foo', () => {
if('bar') {}
})
if('baz') {}
`,
parser,
errors: [
{
messageId: 'noIf',
},
],
},
{
code: `it('foo', () => {
callExpression()
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1761,13 +1761,6 @@ eslint-plugin-jsx-a11y@6.2.1:
has "^1.0.3"
jsx-ast-utils "^2.0.1"

eslint-plugin-lodash@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-5.1.0.tgz#f7dc6c14f104cacb169a18d17c27d9c015a53924"
integrity sha512-mMKmf1OMLS8VExtaHCcrwBmsYIiOVYEibnAFDzXrbJdtFGOcLEw37tryN/WGYKBiJy6nAIGC43i5Wh3KA9lO2g==
dependencies:
lodash "4.17.11"

eslint-plugin-node@8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz#55ae3560022863d141fa7a11799532340a685964"
Expand Down Expand Up @@ -3030,7 +3023,7 @@ lodash.unescape@4.0.1:
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=

lodash@4.17.11, lodash@^4.11.1, lodash@^4.17.11, lodash@^4.3.0:
lodash@^4.11.1, lodash@^4.17.11, lodash@^4.3.0:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
Expand Down

0 comments on commit a603711

Please sign in to comment.