# no-confusing-set-timeout

Rule `jest/no-confusing-set-timeout`. Disallow confusing usages of jest.setTimeout

- Source: jest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1739 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jest/no-confusing-set-timeout` | no | no | package `eslint-plugin-jest` | [docs](https://github.com/jest-community/eslint-plugin-jest/blob/v29.17.2/docs/rules/no-confusing-set-timeout.md) |
| Oxlint | `jest/no-confusing-set-timeout` | no | no | plugin `jest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/jest/no-confusing-set-timeout.html) |

## Code examples

### Incorrect: the rule reports this

```js
describe('test foo', () => {
  jest.setTimeout(1000);
  it('test-description', () => {
    // test logic;
  });
});

describe('test bar', () => {
  it('test-description', () => {
    jest.setTimeout(1000);
    // test logic;
  });
});

test('foo-bar', () => {
  jest.setTimeout(1000);
});

describe('unit test', () => {
  beforeEach(() => {
    jest.setTimeout(1000);
  });
});
```

### Correct: the rule accepts this

```js
jest.setTimeout(500);
test('test test', () => {
  // do some stuff
});
```

```js
jest.setTimeout(1000);
describe('test bar bar', () => {
  it('test-description', () => {
    // test logic;
  });
});
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { jest },
    rules: {
      "jest/no-confusing-set-timeout": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "jest"
  ],
  "rules": {
    "jest/no-confusing-set-timeout": "error"
  }
}
```

## Related rules

- [jest/no-conditional-in-test](https://lintradar.dev/rules/jest/no-conditional-in-test.md): Disallow conditional logic in tests
- [jest/no-large-snapshots](https://lintradar.dev/rules/jest/no-large-snapshots.md): Disallow large snapshots
- [jest/max-expects](https://lintradar.dev/rules/jest/max-expects.md): Enforces a maximum number assertion calls in a test body
- [jest/no-restricted-jest-methods](https://lintradar.dev/rules/jest/no-restricted-jest-methods.md): Disallow specific `jest.` methods
- [jest/no-restricted-matchers](https://lintradar.dev/rules/jest/no-restricted-matchers.md): Disallow specific matchers & modifiers
- [jest/no-unneeded-async-expect-function](https://lintradar.dev/rules/jest/no-unneeded-async-expect-function.md): Disallow unnecessary async function wrapper for expected promises

---

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