# padding-around-expect-groups

Rule `vitest/padding-around-expect-groups`. Enforce padding around `expect` groups

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

## Linters

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

## Code examples

### Incorrect: the rule reports this

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

### Correct: the rule accepts this

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

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

  abc = 456

  expect(abc).toEqual(456)
})
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/padding-around-expect-groups": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/padding-around-expect-groups": "error"
  }
}
```

## Related rules

- [jest/padding-around-expect-groups](https://lintradar.dev/rules/jest/padding-around-expect-groups.md): Enforce padding around `expect` groups
- [vitest/padding-around-describe-blocks](https://lintradar.dev/rules/vitest/padding-around-describe-blocks.md): Enforce padding around `describe` blocks
- [vitest/padding-around-test-blocks](https://lintradar.dev/rules/vitest/padding-around-test-blocks.md): Enforce padding around `test` blocks
- [vitest/padding-around-before-each-blocks](https://lintradar.dev/rules/vitest/padding-around-before-each-blocks.md): Enforce padding around `beforeEach` blocks
- [vitest/prefer-called-once](https://lintradar.dev/rules/vitest/prefer-called-once.md): Enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`
- [vitest/padding-around-before-all-blocks](https://lintradar.dev/rules/vitest/padding-around-before-all-blocks.md): Enforce padding around `beforeAll` blocks

---

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