Skip to content

testCasePaddingLines

Enforces padding around test blocks.

✅ This rule is included in the vitest stylisticStrict presets.

Blank lines around test() and it() blocks make individual cases read like separate units. That spacing is especially helpful in suites with many neighboring cases, focused tests, or skipped tests.

import { it, test } from "vitest";
const first = "bar";
const second = "baz";
it(first, () => {
// ...
});
it.only(second, () => {
// ...
});
test("third", () => {
// ...
});
test("fourth", () => {
// ...
});
import { describe, expect, it, test } from "vitest";
describe("nested", () => {
const thing = 123;
test("one", () => {
expect(thing).toBe(123);
});
// With a comment
it("two", () => {
expect(thing).toBe(123);
});
test.skip("three", () => {
// ...
});
it.skip("four", () => {
// ...
});
});

This rule is not configurable.

If your project keeps very small test files and prefers denser case lists, the extra blank lines from this rule may not be worth it. That can be reasonable when each suite contains only a handful of short tests.

Made with ❤️‍🔥 around the world by the Flint team and contributors.