Enforces padding around expect groups.
✅ 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.
AEimpo53 { expect, test <} sp ansty="le--0:#C792EA;--1:#8844">AEfr} sp>5<3 sp ansty="le--0:#D9F5DD;--1:#1111">13 sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dvite1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3;d ivclassNa="meec-li">d3;d>B0te5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dval1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><, sp ansty="le--0:#D9F5DD;--1:#1111">11, sp><()sp ansty="le--0:#D6DEEB;--1:#403F">5()sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE3 sp><=>sp ansty="le--0:#D6DEEB;--1:#403F">53=>sp>< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEle sp>53couAE <= sp ansty="le--0:#F78C6C;--1:#AA09">821= sp><23sp ansty="le--0:#D6DEEB;--1:#403F">523sp> {d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expe sp>53(counAB0toEqu5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8213(sp><23sp ansty="le--0:#D6DEEB;--1:#403F">5323sp>3;d><);d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expe sp>5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8213(sp><23sp ansty="le--0:#D6DEEB;--1:#403F">523sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toEqu53(count);d><);d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53coun sp>A5<3 sp ansty="le--0:#F78C6C;--1:#AA09">8243 sp><56sp ansty="le--0:#D6DEEB;--1:#403F">556sp>);d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expe sp>53(counAB0toEqu5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8243(sp><56sp ansty="le--0:#D6DEEB;--1:#403F">5356sp>3;d><);d ivclassNa="meec-li">53});d><);d ivclassNa="meco"> { let count = 123; expect(count).toEqual(123); expect(123).toEqual(count); count = 456; expect(count).toEqual(456);}"><);d>);d>);d>AEimpo53 { expectTypeOf, test <} sp ansty="le--0:#C792EA;--1:#8844">AEfr} sp>5<3 sp ansty="le--0:#D9F5DD;--1:#1111">13 sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dvite1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3;d ivclassNa="meec-li">d3;d>B0te5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dtyp1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><, sp ansty="le--0:#D9F5DD;--1:#1111">11, sp><()sp ansty="le--0:#D6DEEB;--1:#403F">5()sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE3 sp><=>sp ansty="le--0:#D6DEEB;--1:#403F">53=>sp>< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEcons sp>B0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">821= sp><23sp ansty="le--0:#D6DEEB;--1:#403F">523sp> {d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expectType sp>53(valuAB0toBeNumb53(3;d><);d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expectType sp>53(valuAB0toBeNumb53();d><);d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEcons sp>B0teAE <= sp ansty="le--0:#D9F5DD;--1:#1111">1= sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Da1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp>);d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#919F9F;--1:#5D63">76// Comme sp>3;d>nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expectType sp>53(texAB0toBeStri53(<);d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0expectType sp>53(texAB0toBeStri53();d><);d ivclassNa="meec-li">53});d><);d ivclassNa="meco"> { const value = 123; expectTypeOf(value).toBeNumber(); expectTypeOf(value).toBeNumber(); const text = "abc"; // Comment expectTypeOf(text).toBeString(); expectTypeOf(text).toBeString();}"><);d>);d>);d> 44AEim3F53 { expect, tes44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dvi111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3111">c61B031<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dv111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53, spans="tyle--0:#D9F5DD;--1:#11">1153, ><11() spans="tyle--0:#D6DEEB;--1:#40">311()>44 spans="tyle--0:#D6DEEB;--1:#40">3F><53 {divclass="Nameec-">de44AE3F53c44A098<2123 spans="tyle--0:#D6DEEB;--1:#40">32123>53 >cde61B0ex3F53(co4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toE4AE.>3098<2123 spans="tyle--0:#D6DEEB;--1:#40">3F2123><53) ;divclass="Nameec-">de61B0ex3098<2123 spans="tyle--0:#D6DEEB;--1:#40">32123>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toE4AE.>3F53(cou53)>c3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53co53 >4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>098<2456 spans="tyle--0:#D6DEEB;--1:#40">32456>cde61B0ex3F53(co4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toE4AE.>3098<2456 spans="tyle--0:#D6DEEB;--1:#40">3F2456><53) ;divclass="Nameec-">3F553)><3}) ;divclass="Name"> { let count = 123; expect(count).toEqual(123); expect(123).toEqual(count); count = 456; expect(count).toEqual(456);"><})>})>3})><;di vdivclass="Nameexpressive-">44AEim3F53 { expectTypeOf, tes44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dvi111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3111">c61B031<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dt111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53, spans="tyle--0:#D9F5DD;--1:#11">1153, ><11() spans="tyle--0:#D6DEEB;--1:#40">311()>44 spans="tyle--0:#D6DEEB;--1:#40">3F><53 {divclass="Nameec-">de44AEco61B0v44A098<2123 spans="tyle--0:#D6DEEB;--1:#40">32123>53 >cde61B0expectTy3F53(va4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toBeNu4AE.>3F5<3() ;divclass="Nameec-">de61B0expectTy3F53(va4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toBeNu4AE.>3F53()><3() ;divclass="Nameec-">c3()>de44AEco61B044A1<111" spans="tyle--0:#ECC48D;--1:#98">4E4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3111">cde6376// Comde61B0expectTy3F53(t4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toBeSt4AE.>3F5<3() ;divclass="Nameec-">de61B0expectTy3F53(t4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toBeSt4AE.>3F53()><3() ;divclass="Nameec-">3F53()><3}) ;divclass="Name"> { const value = 123; expectTypeOf(value).toBeNumber(); expectTypeOf(value).toBeNumber(); const text = "abc"; // Comment expectTypeOf(text).toBeString(); expectTypeOf(text).toBeString();"><})>})>3})>;di>
This rule is not configurable.
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.