Skip to content

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.

beforeEach(() => {
// ...
});
test("...", () => {
// ...
});

This rule is not configurable.

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.

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