# describe, it and expect

*phrase*

say it: **“dih-SKRIBE, IT and ek-SPEKT”** **/dɪˈskraɪb ɪt ænd ɪkˈspɛkt/**

Three functions test files use: one to group related tests, one to write a single test, and one to check a result.

## What do **describe, it** and **expect** do?

In Jest and Vitest, _**describe**_ groups tests, _**it**_ defines the test, and _**expect(...).toBe(...)**_ makes the assertions.

```javascript
describe('cart', () => {
  it('starts empty', () => {
    expect(new Cart().items).toEqual([]);
  });
});
```

## In a sentence

- “With **describe, it and expect**, my test file reads almost like a sentence: the cart, it starts empty, expect zero items.”
- “I grouped the playlist tests with **describe, it and expect** so the report lists them under one heading.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/describe-it-and-expect
