# padding-around-test-blocks

Rule `vitest/padding-around-test-blocks`. Enforce padding around `test` blocks

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

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
const someText = 'hoge'
test('hoge', () => {})
test('foo', () => {})
```

```js
const someText = 'hoge'
it('hoge', () => {})
it('foo', () => {})
```

### Correct: the rule accepts this

```js
const someText = 'hoge'

test('hoge', () => {})

test('foo', () => {})
```

```js
const someText = 'hoge'

it('hoge', () => {})

it('foo', () => {})
```

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-test-blocks": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [jest/padding-around-test-blocks](https://lintradar.dev/rules/jest/padding-around-test-blocks.md): Enforce padding around `test` and `it` blocks
- [vitest/padding-around-expect-groups](https://lintradar.dev/rules/vitest/padding-around-expect-groups.md): Enforce padding around `expect` groups
- [vitest/prefer-called-once](https://lintradar.dev/rules/vitest/prefer-called-once.md): Enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`
- [vitest/padding-around-describe-blocks](https://lintradar.dev/rules/vitest/padding-around-describe-blocks.md): Enforce padding around `describe` blocks
- [vitest/prefer-comparison-matcher](https://lintradar.dev/rules/vitest/prefer-comparison-matcher.md): Enforce using the built-in comparison matchers
- [vitest/padding-around-before-each-blocks](https://lintradar.dev/rules/vitest/padding-around-before-each-blocks.md): Enforce padding around `beforeEach` blocks

---

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