Easy Setup
Complete and easy to set-up JavaScript testing solution. Works out of the box for any React project.
Instant Feedback
Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly.
Snapshot Testing
Capture snapshots of React trees or other serializable values to simplify UI testing and to analyze how state changes over time.
Zero configuration testing platform
Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated “zero-configuration” experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.
Fast and sandboxed
Jest parallelizes test runs across workers to maximize performance. Console messages are buffered and printed together with test results. Sandboxed test files and automatic global state resets for every test so no two tests conflict with each other.
Built-in code coverage reports
Easily create code coverage reports using --coverage
. No additional setup or libraries needed! Jest can collect code coverage information from entire projects, including untested files.
Zero configuration
Jest is already configured when you use create-react-app
or react-native init
to create your React and React Native projects. Place your tests in a __tests__
folder, or name your test files with a .spec.js
or .test.js
extension. Whatever you prefer, Jest will find and run your tests.
Try it out!
You can try out a real version of Jest using repl.it. Consider a function, add()
, that adds two numbers. We can use a basic test in add-test.js
to verify that 1 + 2 equals 3. Hit "run" to try it out!
Powerful mocking library
Powerful mocking library for functions and modules. Mock React Native components using jest-react-native
.
Learn how to test JavaScript with Jest
In this video by Kent C. Dodds you will learn how to install Jest and write your first unit test.
Who's using Jest?
Jest is used by teams of all sizes to test web application, node.js services, mobile apps, and APIs.