testing-library/no-debugging-utils

January 5, 2026 ยท View on GitHub

๐Ÿ“ Disallow the use of debugging utilities like debug.

โš ๏ธ This rule warns in the following configs: badge-angular angular, badge-marko marko, badge-react react, badge-svelte svelte, badge-vue vue.

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.

Rule Details

This rule supports disallowing the following debugging utilities:

  • debug
  • logTestingPlaygroundURL
  • prettyDOM
  • logRoles
  • logDOM
  • prettyFormat

By default, all are disallowed.

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();

Options

You can control which debugging utils are checked for with the utilsToCheckFor option:

module.exports = {
	rules: {
		'testing-library/no-debugging-utils': [
			'error',
			{
				utilsToCheckFor: {
					debug: false,
					logRoles: true,
					logDOM: true,
				},
			},
		],
	},
};

Further Reading