vitest/prefer-expect-resolves

January 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce using expect().resolves over expect(await ...) syntax.

โš ๏ธ This rule warns in the ๐ŸŒ all config.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

// bad
it('passes', async () => {
  expect(await someValue()).toBe(true)
})

// good
it('passes', async () => {
  await expect(someValue()).resolves.toBe(true)
})