testCasesWithinDescribes
Reports importing from
node:test.
✅ This rule is included in the vitest stylisticStrict presets.
Vitest allows declaring standalone hooks and tests: those not in a parent describe() block.
Some repositories prefer to always include those in a describe() for consistent test case grouping.
This rule reports on any hook or test declaration not in a parent describe() block.
Examples
Section titled “Examples”beforeEach(() => { // ...});
test("...", () => { // ...});describe("...", () => { beforeEach(() => { // ... });
test("...", () => { // ... });});Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you don’t want to have all hooks and tests declared in describe() blocks, this rule might not be for you.
For example, smaller and/or tightly-organized repositories often have one test file per component or function under test, and so are organized into groups that way already.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”
Made with ❤️🔥 around the world by
the Flint team and contributors.