# prefer-expect-resolves

Rule `vitest/prefer-expect-resolves`. Enforce using `expect().resolves` over `expect(await ...)` syntax

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1795 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vitest/prefer-expect-resolves` | no | safe | package `@vitest/eslint-plugin` | [docs](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md) |
| Oxlint | `vitest/prefer-expect-resolves` | no | safe | plugin `vitest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-resolves.html) |

## Enable it

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

```js
import vitest from "@vitest/eslint-plugin";

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/prefer-expect-resolves": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/prefer-expect-resolves": "error"
  }
}
```

## Related rules

- [jest/prefer-expect-resolves](https://lintradar.dev/rules/jest/prefer-expect-resolves.md): Prefer `await expect(...).resolves` over `expect(await ...)` syntax
- [vitest/prefer-expect-assertions](https://lintradar.dev/rules/vitest/prefer-expect-assertions.md): Enforce using expect assertions instead of callbacks
- [vitest/prefer-expect-type-of](https://lintradar.dev/rules/vitest/prefer-expect-type-of.md): Enforce using `expect(...).toBeTypeOf(...)` instead of `expect(typeof ...).toBe(...)`
- [vitest/prefer-each](https://lintradar.dev/rules/vitest/prefer-each.md): Enforce using `each` rather than manual loops
- [vitest/prefer-import-in-mock](https://lintradar.dev/rules/vitest/prefer-import-in-mock.md): Prefer dynamic import in mock
- [vitest/prefer-comparison-matcher](https://lintradar.dev/rules/vitest/prefer-comparison-matcher.md): Enforce using the built-in comparison matchers

---

Web page: https://lintradar.dev/rules/vitest/prefer-expect-resolves. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
