# describe, it and expect

Group tests, define tests, and assert results.

## 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([]);
  });
});
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: October 12, 2026

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