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', () => {});
});