# no-restricted-jest-methods

Rule `jest/no-restricted-jest-methods`. Disallow specific `jest.` methods

- 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: #1741 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
jest.useFakeTimers();
it('calls the callback after 1 second via advanceTimersByTime', () => {
  // ...

  jest.advanceTimersByTime(1000);

  // ...
});

test('plays video', () => {
  const spy = jest.spyOn(video, 'play');

  // ...
});
```

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-restricted-jest-methods": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [jest/no-large-snapshots](https://lintradar.dev/rules/jest/no-large-snapshots.md): Disallow large snapshots
- [jest/no-restricted-matchers](https://lintradar.dev/rules/jest/no-restricted-matchers.md): Disallow specific matchers & modifiers
- [jest/no-confusing-set-timeout](https://lintradar.dev/rules/jest/no-confusing-set-timeout.md): Disallow confusing usages of jest.setTimeout
- [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
- [jest/no-conditional-in-test](https://lintradar.dev/rules/jest/no-conditional-in-test.md): Disallow conditional logic in tests
- [jest/no-untyped-mock-factory](https://lintradar.dev/rules/jest/no-untyped-mock-factory.md): Disallow using `jest.mock()` factories without an explicit type parameter

---

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