LinuxCommandLibrary

jest

JavaScript testing framework with focus on simplicity

TLDR

Run all tests

$ jest
copy
Run specific test file
$ jest [path/to/test.js]
copy
Run tests matching pattern
$ jest -t "[pattern]"
copy
Run in watch mode
$ jest --watch
copy
Generate coverage report
$ jest --coverage
copy
Update snapshots
$ jest -u
copy
Run tests in parallel
$ jest --maxWorkers=[4]
copy
Run only changed tests
$ jest --onlyChanged
copy

SYNOPSIS

jest [options] [files...]

DESCRIPTION

jest is a JavaScript testing framework with focus on simplicity. It provides test runners, assertions, mocking, and code coverage in a single package.
The tool features snapshot testing, parallel execution, and intelligent test selection. It works with React, Vue, Node.js, and most JavaScript projects.

PARAMETERS

--watch

Watch mode for changed files.
--watchAll
Watch all files.
--coverage
Collect code coverage.
-t pattern
Run matching test names.
-u, --updateSnapshot
Update snapshots.
--maxWorkers n
Max parallel workers.
--onlyChanged
Run only changed tests.
--bail
Stop on first failure.
--verbose
Display individual test results.
--config file
Configuration file.
--ci
CI mode settings.

CAVEATS

Default test regex may miss files. Snapshots need review. Coverage may miss edge cases. Memory usage high with many tests.

HISTORY

Jest was created by Facebook (Meta), initially for testing React applications. Released around 2014, it evolved from Jasmine roots to become one of the most popular JavaScript testing frameworks, known for its zero-configuration approach.

SEE ALSO

npm(1), mocha(1), vitest(1), playwright(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community