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

adds necessary to shopify/jest/no-vague-terms #265

Merged
merged 2 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` ([265](https://github.com/Shopify/eslint-plugin-shopify/pull/265))

### 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
72 changes: 71 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,53 @@ ruleTester.run('no-vague-titles', rule, {
],
invalid: [
{
code: "it('properly should correcly appropriate all')",
code:
"it('properly should correcly appropriate all descriptive necessary')",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the word salad? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what my original thinking was... probably that they all error together are listed properly in the error message. Going to leave it for now.

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 +1500,27 @@ 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',
},
],
},
],
});