src/content/docs/linter/rules/no-done-callback.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v1.6.1` - Diagnostic Category: [`lint/style/noDoneCallback`](/reference/diagnostics#diagnostic-category) - This rule isn't recommended, so you need to enable it. - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`jest/no-done-callback`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-done-callback.md) - Same as [`vitest/no-done-callback`](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md){
"linter": {
"rules": {
"style": {
"noDoneCallback": "error"
}
}
}
}
Disallow using a callback in asynchronous tests and hooks.
This rule checks the function parameter of hooks and tests for use of the done argument, suggesting you return a promise instead.
beforeEach((done) => {
// ...
});
test('tets-name', (done) => {
// ...
});
beforeEach(async () => {
// ...
});
test('test-name', () => {
expect(myFunction()).toBeTruthy();
});