Skip to content

Commit

Permalink
chore(valid-title): update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Oct 26, 2019
1 parent 42d2b7f commit 81b1504
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 40 deletions.
4 changes: 1 addition & 3 deletions README.md
Expand Up @@ -117,7 +117,6 @@ installations requiring long-term consistency.
| [no-commented-out-tests][] | Disallow commented out tests | | |
| [no-disabled-tests][] | Disallow disabled tests | ![recommended][] | |
| [no-duplicate-hooks][] | Disallow duplicate hooks within a `describe` block | | |
| [no-empty-title][] | Disallow empty titles | | |
| [no-expect-resolves][] | Disallow using `expect().resolves` | | |
| [no-export][] | Disallow export from test files | | |
| [no-focused-tests][] | Disallow focused tests | ![recommended][] | |
Expand Down Expand Up @@ -150,7 +149,7 @@ installations requiring long-term consistency.
| [valid-describe][] | Enforce valid `describe()` callback | ![recommended][] | |
| [valid-expect-in-promise][] | Enforce having return statement when testing with promises | ![recommended][] | |
| [valid-expect][] | Enforce valid `expect()` usage | ![recommended][] | |
| [valid-title][] | Disallow invalid `describe`/`test` titles | | |
| [valid-title][] | Enforce valid titles for jest blocks | | |

## Credit

Expand All @@ -173,7 +172,6 @@ https://github.com/dangreenisrael/eslint-plugin-jest-formatting
[no-commented-out-tests]: docs/rules/no-commented-out-tests.md
[no-disabled-tests]: docs/rules/no-disabled-tests.md
[no-duplicate-hooks]: docs/rules/no-duplicate-hooks.md
[no-empty-title]: docs/rules/no-empty-title.md
[no-expect-resolves]: docs/rules/no-expect-resolves.md
[no-export]: docs/rules/no-export.md
[no-focused-tests]: docs/rules/no-focused-tests.md
Expand Down
36 changes: 0 additions & 36 deletions docs/rules/no-empty-title.md

This file was deleted.

38 changes: 37 additions & 1 deletion docs/rules/valid-title.md
@@ -1,9 +1,45 @@
# describe/test titles should be valid (valid-title)

A describe/ test block should not contain accidentalSpace or duplicatePrefix.
Checks that the title of Jest blocks are valid by ensuring that titles are:

- not empty,
- not prefixed with their block name
- have no leading or trailing spaces

## Rule Details

**emptyTitle**

An empty title is not informative, and serves little purpose.

Examples of **incorrect** code for this rule:

```js
describe('', () => {});
describe('foo', () => {
it('', () => {});
});
it('', () => {});
test('', () => {});
xdescribe('', () => {});
xit('', () => {});
xtest('', () => {});
```

Examples of **correct** code for this rule:

```js
describe('foo', () => {});
describe('foo', () => {
it('bar', () => {});
});
test('foo', () => {});
it('foo', () => {});
xdescribe('foo', () => {});
xit('foo', () => {});
xtest('foo', () => {});
```

**duplicatePrefix**

A describe/ test block should not start with duplicatePrefix
Expand Down

0 comments on commit 81b1504

Please sign in to comment.