diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a630d2..edbbe55c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ +### Changed + +- added "necessary" to `shopify/jest/no-vague-titles` + ### Added - New Rules: @@ -10,6 +14,7 @@ - `react/state-in-constructor` Enforce state initialization to be in a class property. ([256](https://github.com/Shopify/eslint-plugin-shopify/pull/246)) ### Fixed + - `react-prefer-private-members` from incorrectly reporting the members of a parent class if a React class is defined within its constructor. ([258](https://github.com/Shopify/eslint-plugin-shopify/pull/258)) ## [28.0.0] - 2019-04-26 diff --git a/lib/rules/jest/no-vague-titles.js b/lib/rules/jest/no-vague-titles.js index 599f1f2c..6c61be6a 100644 --- a/lib/rules/jest/no-vague-titles.js +++ b/lib/rules/jest/no-vague-titles.js @@ -13,6 +13,7 @@ const VAGUE_TERMS = { properly: /properly/i, every: /every/i, descriptive: /descriptive/i, + necessary: /necessary/i, }; module.exports = { diff --git a/tests/lib/rules/jest/no-vague-titles.js b/tests/lib/rules/jest/no-vague-titles.js index 440af9b7..f2f03d14 100644 --- a/tests/lib/rules/jest/no-vague-titles.js +++ b/tests/lib/rules/jest/no-vague-titles.js @@ -142,7 +142,52 @@ ruleTester.run('no-vague-titles', rule, { ], invalid: [ { - code: "it('properly should correcly appropriate all')", + code: "it('properly should correcly appropriate all descriptive necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "it('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "describe('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "test('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "fit('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "xdescribe('necessary')", parser, errors: [ { @@ -1454,3 +1499,26 @@ ruleTester.run('no-vague-titles with allow=descriptive', rule, { }, ], }); + +ruleTester.run('no-vague-titles with allow=necessary', rule, { + valid: [ + { + code: "it('necessary')", + options: [{allow: ['necessary']}], + }, + { + code: "it('necessary all should')", + options: [{allow: ['necessary', 'should', 'all']}], + }, + ], + invalid: [ + { + code: "it('properly all should')", + options: [{allow: ['necessary', 'should']}], + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + ],