# no-done-callback

Rule `jest/no-done-callback`. Disallow using a callback in asynchronous tests and hooks

- Source: jest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 16.7M weekly downloads of presets that enable it
- Trend: +10.1% last quarter
- Rank: #655 by reach, #1462 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jest/no-done-callback` | yes | suggestion | package `eslint-plugin-jest` | [docs](https://github.com/jest-community/eslint-plugin-jest/blob/v29.17.2/docs/rules/no-done-callback.md) |
| Oxlint | `jest/no-done-callback` | no | no | plugin `jest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/jest/no-done-callback.html) |
| Biome | `style/noDoneCallback` | no | no | group style, since 1.6.1 | [docs](https://biomejs.dev/linter/rules/no-done-callback/) |

## Code examples

### Incorrect: the rule reports this

```js
test('the data is peanut butter', done => {
  function callback(data) {
    try {
      expect(data).toBe('peanut butter');
      done();
    } catch (error) {
      done(error);
    }
  }

  fetchData(callback);
});
```

```js
beforeEach(done => {
  // ...
});

test('myFunction()', done => {
  // ...
});

test('myFunction()', function (done) {
  // ...
});
```

Examples from the Oxlint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import jest from "eslint-plugin-jest";

export default [
  {
    plugins: { jest },
    rules: {
      "jest/no-done-callback": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "jest"
  ],
  "rules": {
    "jest/no-done-callback": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noDoneCallback": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Jest recommended](https://lintradar.dev/presets/jest-recommended.md) | ESLint | `eslint-plugin-jest` | 19 | 16.7M | +10.1% |

## Related rules

- [vitest/no-done-callback](https://lintradar.dev/rules/vitest/no-done-callback.md): Disallow using a callback in asynchronous tests and hooks
- [jest/no-conditional-expect](https://lintradar.dev/rules/jest/no-conditional-expect.md): Disallow calling `expect` conditionally
- [jest/no-jasmine-globals](https://lintradar.dev/rules/jest/no-jasmine-globals.md): Disallow Jasmine globals
- [jest/expect-expect](https://lintradar.dev/rules/jest/expect-expect.md): Enforce assertion to be made in a test body
- [jest/no-standalone-expect](https://lintradar.dev/rules/jest/no-standalone-expect.md): Disallow using `expect` outside of `it` or `test` blocks
- [jest/valid-title](https://lintradar.dev/rules/jest/valid-title.md): Enforce valid titles

---

Web page: https://lintradar.dev/rules/jest/no-done-callback. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
