Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.24 KB

File metadata and controls

42 lines (29 loc) · 1.24 KB

Disallow the use of debug (testing-library/no-debug)

Just like console.log statements pollutes the browser's output, debug statements also pollutes the tests if one of your teammates forgot to remove it. debug statements should be used when you actually want to debug your tests but should not be pushed to the codebase.

By default, this rule disallows the debug and logTestingPlaygroundURL utils.

Rule Details

This rule aims to disallow the use of debug in your tests.

Examples of incorrect code for this rule:

const { debug } = render(<Hello />);
debug();
const utils = render(<Hello />);
utils.debug();
import { screen } from '@testing-library/dom';
screen.debug();
const { screen } = require('@testing-library/react');
screen.debug();

If you want to allow the use of some debugging functions, you can configure what names this rule checks for with the utilNames option:

   "testing-library/no-debug": ["error", {"utilNames": ["debug"}],

Further Reading