source: frontend/node_modules/eslint-plugin-jest/docs/rules/no-commented-out-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.3 KB
Line 
1# Disallow commented out tests (`no-commented-out-tests`)
2
3This rule raises a warning about commented out tests. It's similar to
4no-disabled-tests rule.
5
6## Rule Details
7
8The rule uses fuzzy matching to do its best to determine what constitutes a
9commented out test, checking for a presence of `it(`, `describe(`, `it.skip(`,
10etc. in code comments.
11
12The following patterns are considered warnings:
13
14```js
15// describe('foo', () => {});
16// it('foo', () => {});
17// test('foo', () => {});
18
19// describe.skip('foo', () => {});
20// it.skip('foo', () => {});
21// test.skip('foo', () => {});
22
23// describe['skip']('bar', () => {});
24// it['skip']('bar', () => {});
25// test['skip']('bar', () => {});
26
27// xdescribe('foo', () => {});
28// xit('foo', () => {});
29// xtest('foo', () => {});
30
31/*
32describe('foo', () => {});
33*/
34```
35
36These patterns would not be considered warnings:
37
38```js
39describe('foo', () => {});
40it('foo', () => {});
41test('foo', () => {});
42
43describe.only('bar', () => {});
44it.only('bar', () => {});
45test.only('bar', () => {});
46
47// foo('bar', () => {});
48```
49
50### Limitations
51
52The plugin looks at the literal function names within test code, so will not
53catch more complex examples of commented out tests, such as:
54
55```js
56// const testSkip = test.skip;
57// testSkip('skipped test', () => {});
58
59// const myTest = test;
60// myTest('does not have function body');
61```
Note: See TracBrowser for help on using the repository browser.