source: frontend/node_modules/eslint-plugin-jest/docs/rules/no-disabled-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.5 KB
Line 
1# Disallow disabled tests (`no-disabled-tests`)
2
3Jest has a feature that allows you to temporarily mark tests as disabled. This
4feature is often helpful while debugging or to create placeholders for future
5tests. Before committing changes we may want to check that all tests are
6running.
7
8This rule raises a warning about disabled tests.
9
10## Rule Details
11
12There are a number of ways to disable tests in Jest:
13
14- by appending `.skip` to the test-suite or test-case
15- by prepending the test function name with `x`
16- by declaring a test with a name but no function body
17- by making a call to `pending()` anywhere within the test
18
19The following patterns are considered warnings:
20
21```js
22describe.skip('foo', () => {});
23it.skip('foo', () => {});
24test.skip('foo', () => {});
25
26describe['skip']('bar', () => {});
27it['skip']('bar', () => {});
28test['skip']('bar', () => {});
29
30xdescribe('foo', () => {});
31xit('foo', () => {});
32xtest('foo', () => {});
33
34it('bar');
35test('bar');
36
37it('foo', () => {
38 pending();
39});
40```
41
42These patterns would not be considered warnings:
43
44```js
45describe('foo', () => {});
46it('foo', () => {});
47test('foo', () => {});
48
49describe.only('bar', () => {});
50it.only('bar', () => {});
51test.only('bar', () => {});
52```
53
54### Limitations
55
56The plugin looks at the literal function names within test code, so will not
57catch more complex examples of disabled tests, such as:
58
59```js
60const testSkip = test.skip;
61testSkip('skipped test', () => {});
62
63const myTest = test;
64myTest('does not have function body');
65```
Note: See TracBrowser for help on using the repository browser.