Matcher - The assertion function after expect() (toBe, toEqual, toThrow); a precise matcher gives a precise error message rather than a generic "did not match".
toBe / toEqual - toBe compares by reference/primitive (Object.is), toEqual compares recursively by value; confusing the two is a common source of false failures.
Test isolation - Each test starts in a clean world: fresh mocks and modules, reset state; otherwise run order changes the result.
beforeEach / afterEach - Setup and teardown hooks around each test; this is where mocks, timers and shared state are reset so tests do not affect each other.
Mock Function (jest.fn) - A stub function that records calls and arguments (mock.calls) and lets you set a return value or behavior; assert the result, not merely that it was called.
Module mock (jest.mock) - Replacing a whole module at a boundary (network, file system, SDK); a last resort - an extra mock hides real behavior.
Fake timers - Replacing timers and the clock (jest.useFakeTimers) for determinism: time is advanced manually (advanceTimersByTime) instead of waiting for real delays.
Snapshot - A stored reference of output; useful as a reviewable contract for a small serializable result, harmful as a dump of an entire DOM.
Coverage - The share of code EXECUTED during a run; it shows a line ran, not that its behavior was actually checked by an assertion.
Testing Library - A library that queries the UI by accessible name and role rather than implementation details; it tests the interface through the user's eyes.
next/jest - The official Next.js preset configuring transformation, aliases and environment; it removes manual config fiddling for Next.
Projects - Several Jest configurations in one run (different environments/monorepo packages), each with its own environment and setup.
Flaky test - A test that fails non-deterministically (time, order, network, races); it is a defect in the test or code, not randomness to retry away.
test.each - Parameterization: one scenario over a set of inputs and expectations; it cuts copy-paste and makes edge cases explicit.
- A DOM implementation in Node for testing browser code without a real browser; in Jest it is turned on with testEnvironment: 'jsdom', while the default environment is node.
jsdom
Test double - The umbrella term for replacements (stub, spy, mock, fake); the choice depends on whether you verify state or interaction.