|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
884 bytes
|
| Line | |
|---|
| 1 | # Use `.only` and `.skip` over `f` and `x` (`no-test-prefixes`)
|
|---|
| 2 |
|
|---|
| 3 | Jest allows you to choose how you want to define focused and skipped tests, with
|
|---|
| 4 | multiple permutations for each:
|
|---|
| 5 |
|
|---|
| 6 | - **only & skip:** `it.only`, `test.only`, `describe.only`, `it.skip`,
|
|---|
| 7 | `test.skip`, `describe.skip`.
|
|---|
| 8 | - **'f' & 'x':** `fit`, `fdescribe`, `xit`, `xtest`, `xdescribe`.
|
|---|
| 9 |
|
|---|
| 10 | This rule enforces usages from the **only & skip** list.
|
|---|
| 11 |
|
|---|
| 12 | ## Rule details
|
|---|
| 13 |
|
|---|
| 14 | This rule triggers a warning if you use one of the keywords from the **'f' &
|
|---|
| 15 | 'x'** list to focus/skip a test.
|
|---|
| 16 |
|
|---|
| 17 | ```js
|
|---|
| 18 | /*eslint jest/no-test-prefixes: "error"*/
|
|---|
| 19 |
|
|---|
| 20 | it.only('foo'); // valid
|
|---|
| 21 | test.only('foo'); // valid
|
|---|
| 22 | describe.only('foo'); // valid
|
|---|
| 23 | it.skip('foo'); // valid
|
|---|
| 24 | test.skip('foo'); // valid
|
|---|
| 25 | describe.skip('foo'); // valid
|
|---|
| 26 |
|
|---|
| 27 | fit('foo'); // invalid
|
|---|
| 28 | fdescribe('foo'); // invalid
|
|---|
| 29 | xit('foo'); // invalid
|
|---|
| 30 | xtest('foo'); // invalid
|
|---|
| 31 | xdescribe('foo'); // invalid
|
|---|
| 32 | ```
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.