valid-describe-callback

July 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce valid describe callbacks.

๐Ÿ’ผ This rule is enabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

node:test calls a describe/suite callback with no arguments and ignores its return value. A parameter on the callback is usually a mistake, confusing it with a test/it callback, which does receive the test context. An implicit return from an arrow callback registers tests through a returned expression instead of statements in a block body, which is harder to read.

This rule reports a describe/suite callback that declares a parameter or has an arrow expression body. A top-level return inside a block body is not reported.

See also no-async-describe, which covers async callbacks.

Examples

import {describe, test} from 'node:test';

// โŒ
describe('user', t => {
	test('has a name', () => {});
});

// โŒ
describe('user', () => test('has a name', () => {}));

// โœ…
describe('user', () => {
	test('has a name', () => {});
});