no-done-callback

July 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow callback (done) parameters in tests and hooks.

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

node:test lets a test or hook opt into callback style by declaring a second done parameter, which it then calls to signal completion. Callbacks are easy to get wrong: forget to call done and the test hangs until it times out, call it twice and the run errors, and you cannot combine it with a returned Promise. Promises (async/await or returning a Promise) avoid all of this.

This rule reports a test or hook whose function declares a second parameter (the done callback). A second parameter that has a default value or is a rest element is not counted, mirroring how node:test computes the arity to decide whether to pass done.

This is the broader, opt-in counterpart to no-callback-and-promise, which only reports the always-failing case of mixing a callback with an async/Promise function. If you enable this rule, you can disable no-callback-and-promise as redundant.

Examples

import test from 'node:test';

// โŒ
test('title', (t, done) => {
	doSomething(done);
});

// โœ… (async/await)
test('title', async t => {
	await doSomething();
});

// โœ… (return a Promise)
test('title', t => doSomething());