# jest/padding-around-test-blocks

> Require a blank line before each `test` and `it` call

Tests that sit right under each other, or right under setup code, are hard to tell apart when you scan a file. A blank line above each `test` or `it` call separates them.

The rule only checks the line above the call, not the line below. Comments directly above the call count as part of it, so the blank line goes above them. A test that comes first in a file or in a `describe` callback doesn't need a blank line.

`--fix` inserts the blank line.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"jest/padding-around-test-blocks" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```js
import { describe, expect, test } from "@jest/globals";

describe("cart", () => {
  const cart = createCart();
  test("starts empty", () => {
    expect(cart.items).toEqual([]);
  });
  test.skip("adds an item", () => {
    expect(cart.add("apple").items).toEqual(["apple"]);
  });
});
```

Not reported:

{/* good */}
```js
import { describe, expect, test } from "@jest/globals";

describe("cart", () => {
  const cart = createCart();

  test("starts empty", () => {
    expect(cart.items).toEqual([]);
  });

  // Waits for the new storage layer.
  test.skip("adds an item", () => {
    expect(cart.add("apple").items).toEqual(["apple"]);
  });
});
```
