jest
Run JavaScript and TypeScript tests
TLDR
Run all available tests
Run the test suites from the given files
Run the test suites from files within the current and subdirectories, whose paths match the given regex
Run the tests whose names match the given regex
Run test suites related to a given source file
Run test suites related to all uncommitted files
Watch files for changes and automatically re-run related tests
Display help
SYNOPSIS
jest [options] [<file|directory|pattern> …]
PARAMETERS
--watch
Watch files for changes and rerun tests related to changed files
--watchAll
Watch files for changes and rerun all tests
--coverage
Indicates whether coverage information should be collected
--ci
Run in CI mode (similar to --no-interactive --no-watchman)
--config
Path to Jest config file
--init
Initialize Jest configuration
--clearCache
Clear Jest's cache
--debug
Print additional debug information
--silent
Prevent tests from outputting messages to console
--verbose
Display individual test results
--runInBand
Run tests serially in current process
--updateSnapshot
Update failing snapshots
--testNamePattern
Run tests with matching name using regex
--testPathPattern
Run tests located in matching paths
--bail
Exit after first test failure
DESCRIPTION
Jest is a delightful JavaScript Testing Framework with a focus on simplicity and developer experience. Developed by Facebook (now Meta), it provides instant feedback with zero configuration for most projects. It supports testing for React, Node.js, TypeScript, Babel, Vue, Angular, and more.
Jest runs tests in parallel by default, offers snapshot testing, code coverage reports, mocking capabilities, and a built-in assertion library powered by Jasmine. On Linux, it's typically installed via npm or yarn as a dev dependency and invoked from Node.js projects.
Key strengths include watch mode for rapid iteration, automatic test environment setup, and robust matching utilities. It's widely used in modern web development for unit, integration, and end-to-end testing, making it faster and more reliable than traditional runners like Mocha.
CAVEATS
Requires Node.js (≥14); not a native Linux binary—instantiate via npm/yarn. Large projects may need config tweaks for performance. Cache issues can occur across Node versions.
INSTALLATION
npm install --save-dev jest
or yarn add --dev jest
Add to package.json: "test": "jest"
CONFIGURATION
Uses jest.config.js or package.json. Key options: testEnvironment, testMatch, collectCoverageFrom, moduleNameMapping.
Run jest --init for guided setup.
HISTORY
Created by Facebook in 2014 as a React testing solution; open-sourced and evolved into a general JS framework. Version 1.0 in 2014; now at v29+ maintained by the Jest community post-Facebook handover in 2020.


