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

Commit

Permalink
adds necessary to vague terms
Browse files Browse the repository at this point in the history
  • Loading branch information
cartogram committed May 15, 2019
1 parent ba6c4e7 commit 6654828
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!-- ## Unreleased -->

### Changed

- added "necessary" to `shopify/jest/no-vague-titles`

### Added

- New Rules:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jest/no-vague-titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const VAGUE_TERMS = {
properly: /properly/i,
every: /every/i,
descriptive: /descriptive/i,
necessary: /necessary/i,
};

module.exports = {
Expand Down
70 changes: 69 additions & 1 deletion tests/lib/rules/jest/no-vague-titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down Expand Up @@ -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',
},
],
},
],

0 comments on commit 6654828

Please sign in to comment.