expectGroupPaddingLines
Enforces padding around
expectgroups.
✅ This rule is included in the vitest preset.
Keeping related expect() calls together and separating them from setup or other statements makes assertions easier to scan.
This rule enforces blank lines around assertion groups while still allowing consecutive expect() or expectTypeOf() calls to stay grouped.
Examples
Section titled “Examples”import { expect, test } from "vitest";
test("value", () => { let count = 123; expect(count).toEqual(123); expect(123).toEqual(count); count = 456; expect(count).toEqual(456);});import { expectTypeOf, test } from "vitest";
test("types", () => { const value = 123; expectTypeOf(value).toBeNumber(); expectTypeOf(value).toBeNumber(); const text = "abc"; // Comment expectTypeOf(text).toBeString(); expectTypeOf(text).toBeString();});import { expect, test } from "vitest";
test("value", () => { let count = 123;
expect(count).toEqual(123); expect(123).toEqual(count);
count = 456;
expect(count).toEqual(456);});import { expectTypeOf, test } from "vitest";
test("types", () => { const value = 123;
expectTypeOf(value).toBeNumber(); expectTypeOf(value).toBeNumber();
const text = "abc";
// Comment expectTypeOf(text).toBeString(); expectTypeOf(text).toBeString();});Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your team prefers mixing setup, logging, and assertions without extra whitespace, this rule may feel too rigid. That can be reasonable in very short tests where assertion boundaries are already obvious.