Jest: JavaScript testing framework with zero configuration

Jest (August 2014, Facebook, stabilised after 2016): JavaScript/TypeScript testing framework with zero config, snapshot testing, built-in mocking, watch mode. React standard and basis of Vitest.

Open SourceWeb JestFacebookMetaTestingJavaScriptReactOpen SourceWeb

A framework for React

Facebook develops Jest internally to test its own JavaScript codebases — React included. Before Jest, Node testing is fragmented: Mocha + Chai + Sinon, Jasmine, AVA, Tape each with different syntax and assembly. Configuring and running takes a lot of setup.

The release

Jest is open-sourced by Facebook in 2014; versions 14.0 (May 2016) and 16.0 (September 2016) mark the transformation into a mass framework with adoption by Create React App. Main author: Christoph Nakazawa. MIT licence. Since 2022 maintained by Meta but donated to OpenJS Foundation.

test('sum adds numbers', () => {
  expect(sum(1, 2)).toBe(3);
});

test('user snapshot', () => {
  expect(renderUser()).toMatchSnapshot();
});

Features

  • Zero config — works out-of-box with ES modules, JSX, TypeScript (via babel-jest)
  • Integrated assertion libraryexpect() with .toBe(), .toEqual(), .toMatch(), .toThrow() matchers
  • Built-in mockingjest.fn(), jest.mock() for modules
  • Snapshot testing — serialises output and compares on subsequent runs
  • Parallel execution — worker pool for parallel tests
  • Code coverage — integrated Istanbul with --coverage
  • Watch mode — interactive, re-runs only affected tests
  • jsdom environment integrated for DOM tests

React Testing Library

In 2018 Kent C. Dodds releases @testing-library/react, which replaces the lower-level Enzyme (Airbnb). The combination Jest + React Testing Library has been the de facto standard for React testing since 2019.

Competitors

  • Mocha + Chai — historical, more configurable and less opinionated
  • AVA — concurrent, minimal
  • Jasmine — older
  • Vitest (2021, born with Vite) — Jest-compatible API, very fast, ESM-first; replacing Jest in many new projects
  • Node Test Runner (Node 20+) — built-in, minimal
  • Bun test — ultra-fast

In the Italian context

Jest has been the de facto standard of Italian React teams since 2018. Used in:

  • Italian headless e-commerce (Magento, Shopify storefront)
  • Fintech — crypto web apps, neobanks
  • Digital PA — PagoPA, App IO, Design System Italia projects
  • B2B SaaS

From 2023 there is a progressive transition to Vitest in new Vite-based projects.


References: Jest (Facebook, open source 2014). Christoph Nakazawa lead. MIT licence. Donated to OpenJS Foundation (2022). React Testing Library (Kent C. Dodds, 2018) React testing standard. Vitest (2021) Jest-compatible replacement.

Need support? Under attack? Service Status
Need support? Under attack? Service Status