describe Block
Question
What does describe() do in Jest?
Hint
describe(name, fn) organizes tests into suites.
Explanation
The describe() function groups related test cases into a test suite. describe("MathUtils", () => { test("adds", () => {...}); test("subtracts", () => {...}); }). describe blocks can be nested. They provide organization and context in test output. beforeEach/afterEach inside describe are scoped to that block. describe.skip skips all tests in the block. Good descriptions: module name, class name, or feature name. Avoid deeply nested describes (hard to read). Each describe should test one unit or feature.
Related Resources
Related Lessons
- Test Structure
Learn structure.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.