test-title-format

July 15, 2026 ยท View on GitHub

๐Ÿ“ Require test titles to match a configured pattern.

๐Ÿšซ This rule is disabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

Enforce a consistent naming convention for test and suite titles by requiring them to match a configurable regular expression pattern. Hook calls have no title and are not checked.

This rule is opt-in. Configure it when your project has a naming convention such as 'Should โ€ฆ' or 'it โ€ฆ'.

Options

format

Type: string

A regular expression pattern string that all test titles must match.

Examples

/* eslint
	node-test/test-title-format: [
		'error',
		{
			format: '^Should'
		}
	]
*/
import test from 'node:test';

// โŒ
test('not starting with Should', () => {});

// โœ…
test('Should pass when called', () => {});
test('Should throw on invalid input', () => {});
/* eslint
	node-test/test-title-format: [
		'error',
		{
			format: '\\.$'
		}
	]
*/
import test from 'node:test';

// โŒ
test('doesn\'t end with a dot', () => {});

// โœ…
test('ends with a dot.', () => {});