source: frontend/node_modules/eslint-plugin-jest/docs/rules/no-focused-tests.md

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: 1.4 KB
Line 
1# Disallow focused tests (`no-focused-tests`)
2
3Jest has a feature that allows you to focus tests by appending `.only` or
4prepending `f` to a test-suite or a test-case. This feature is really helpful to
5debug a failing test, so you don’t have to execute all of your tests. After you
6have fixed your test and before committing the changes you have to remove
7`.only` to ensure all tests are executed on your build system.
8
9This rule reminds you to remove `.only` from your tests by raising a warning
10whenever you are using the exclusivity feature.
11
12## Rule Details
13
14This rule looks for every `describe.only`, `it.only`, `test.only`, `fdescribe`,
15and `fit` occurrences within the source code. Of course there are some
16edge-cases which can’t be detected by this rule e.g.:
17
18```js
19const describeOnly = describe.only;
20describeOnly.apply(describe);
21```
22
23The following patterns are considered warnings:
24
25```js
26describe.only('foo', () => {});
27it.only('foo', () => {});
28describe['only']('bar', () => {});
29it['only']('bar', () => {});
30test.only('foo', () => {});
31test['only']('bar', () => {});
32fdescribe('foo', () => {});
33fit('foo', () => {});
34fit.each`
35 table
36`();
37```
38
39These patterns would not be considered warnings:
40
41```js
42describe('foo', () => {});
43it('foo', () => {});
44describe.skip('bar', () => {});
45it.skip('bar', () => {});
46test('foo', () => {});
47test.skip('bar', () => {});
48it.each()();
49it.each`
50 table
51`();
52test.each()();
53test.each`
54 table
55`();
56```
Note: See TracBrowser for help on using the repository browser.