vitest/padding-around-expect-groups

January 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce padding around expect groups.

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

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

Rule Details

This rule enforces a line of padding before and after 1 or more expect statements.

Note that it doesn't add/enforce a padding line if it's the last statement in its scope and it doesn't add/enforce padding between two or more adjacent expect statements.

Examples of incorrect code for this rule:

test('test', () => {
  let abc = 123
  expect(abc).toEqual(123)
  expect(123).toEqual(abc)
  abc = 456
  expect(abc).toEqual(456)
})

Examples of correct code for this rule:

test('test', () => {
  let abc = 123

  expect(abc).toEqual(123)
  expect(123).toEqual(abc)

  abc = 456

  expect(abc).toEqual(456)
})