vitest/no-test-return-statement

January 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow return statements in tests.

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

Rule Details

incorrect code for this rule:

import { test } from 'vitest'

test('foo', () => {
  return expect(1).toBe(1)
})

correct code for this rule:

import { test } from 'vitest'

test('foo', () => {
  expect(1).toBe(1)
})