What is Jest?

Jest provides you with multiple layers on top of Jasmine.
Jest is a tool in the Javascript Testing Framework category of a tech stack.
Jest is an open source tool with GitHub stars and GitHub forks. Here’s a link to Jest's open source repository on GitHub

Who uses Jest?

Companies
1124 companies reportedly use Jest in their tech stacks, including Airbnb, Facebook, and Instagram.

Developers
4023 developers on StackShare have stated that they use Jest.

Jest Integrations

LambdaTest, SilverStripe, Vitest, Glamorous, and Just are some of the popular tools that integrate with Jest. Here's a list of all 15 tools that integrate with Jest.
Pros of Jest
36
Open source
32
Mock by default makes testing much simpler
23
Testing React Native Apps
20
Parallel test running
16
Fast
13
Bundled with JSDOM to enable DOM testing
8
Mock by default screws up your classes, breaking tests
7
Out of the box code coverage
7
Promise support
6
One stop shop for unit testing
3
Great documentation
2
Assert Library Included
1
Built in watch option with interactive filtering menu
1
Preset support
0
Can be used for BDD
0
Karma
Decisions about Jest

Here are some stack decisions, common use cases and reviews by companies and developers who chose Jest in their tech stack.

We chose to use React as our frontend. This will allow us to effectively manage and condense our code into repeatable components to avoid repetition and promote clarity. We have also decide to use Redux as it has proven to be an efficient way to manage a state space given a complex and scalable product such as ours. To avoid costly time and effort with boiler plate styling of common components, we have decided to use the Semantic UI React open-source library as it provides great customization and clear documentation. Lastly, we will be using Jest for frontend Unit testing, as it is a popular framework and has great support for React.

See more

For our web application's backend, we have decided to create our server using Node.js and npm as our package manager, as this allows us to utilize a developer's skills and knowledge in JS for both the frontend and backend. ExpressJS provides us an easy to learn framework that saves us effort, time and improves productivity in creating our server, while affording us room to add complexity. Passport will be used to implement Oauth2.0 authentication for our web application, allowing our users to sign in with their existing accounts (no one wants to create a remember the password for yet another account). Mongoose will be used to make calls to our backend, this framework will help make these calls more accessible and organized. We have decided to use Redis on our server for any caching we need. This will greatly speed up retrieval times and reduce calls to external sources for any data that could instead be cached on our server. Lastly, we will use Jest as our unit testing framework for our backend as it is very popular and has support for Node.js . Furthermore, this is the same testing framework we will be using for our frontend, thus allowing use quickly learn and implement testing in both frontend and backend.

We have decided to use Heroku as our hosting platform for our server. Heroku provides clear documentation and a quick and simple process to host Node.js applications with their service, along with great support with our version control Git. Furthermore, Heroku also provides a free tier, which allows us to deploy and test our web application from the beginning of development.

MongoDB is our chosen database as a NoSQL database will give us flexibility in storing different types of data and room for scaling our product. We have decided to use MongoDB Atlas to host our database. As they provide a quick and simple start up along with a free tier to host database. Thus, allowing us to rapidly test our server's uses with the database.

See more
Needs advice
on
JestJest
and
Robot FrameworkRobot Framework

Jest and Robot Framework are both named 'Testing Framework' on many sites that I visit. Both aim at testing the client-side of a web application.

I am aware there are differences in their implementation (JavaScript vs Python) and their purpose (Unit test vs Acceptance test). Still, they seem to overlap a lot. Is there a use case to implement BOTH testing frameworks? Suppose a team has written lots of Jest test cases, and code coverage is really good. Is there still a reason to add Robot Framework on top of that?

See more
Needs advice
on
LoopBackLoopBack
and
NestJSNestJS

We inherited this project and the backend is using LoopBack v3. I haven't taken a look at Loopback.io v4, but I'm planning to replace it. The reason being is that Loopback v3 documentation is a bit confusing and we are having trouble packaging the build using Webpack. Not to mention, integrating unit tests (latest Jest).

I still think Loopback is a great tool, but their documentation is really "messy" and hard to navigate through. There's also a constraint of time from our side. So what's the best option out there?

Should I try upgrading to Loopback v4, or trying other stuff? (i.e. NestJS)

Thanks!

See more
Simon Reymann
Senior Fullstack Developer at QUANTUSflow Software GmbH · | 24 upvotes · 4.9M views

Our whole Vue.js frontend stack (incl. SSR) consists of the following tools:

  • Nuxt.js consisting of Vue CLI, Vue Router, vuex, Webpack and Sass (Bundler for HTML5, CSS 3), Babel (Transpiler for JavaScript),
  • Vue Styleguidist as our style guide and pool of developed Vue.js components
  • Vuetify as Material Component Framework (for fast app development)
  • TypeScript as programming language
  • Apollo / GraphQL (incl. GraphiQL) for data access layer (https://apollo.vuejs.org/)
  • ESLint, TSLint and Prettier for coding style and code analyzes
  • Jest as testing framework
  • Google Fonts and Font Awesome for typography and icon toolkit
  • NativeScript-Vue for mobile development

The main reason we have chosen Vue.js over React and AngularJS is related to the following artifacts:

  • Empowered HTML. Vue.js has many similar approaches with Angular. This helps to optimize HTML blocks handling with the use of different components.
  • Detailed documentation. Vue.js has very good documentation which can fasten learning curve for developers.
  • Adaptability. It provides a rapid switching period from other frameworks. It has similarities with Angular and React in terms of design and architecture.
  • Awesome integration. Vue.js can be used for both building single-page applications and more difficult web interfaces of apps. Smaller interactive parts can be easily integrated into the existing infrastructure with no negative effect on the entire system.
  • Large scaling. Vue.js can help to develop pretty large reusable templates.
  • Tiny size. Vue.js weights around 20KB keeping its speed and flexibility. It allows reaching much better performance in comparison to other frameworks.
See more
Shared insights
at

I'm working as one of the engineering leads in RunaHR. As our platform is a Saas, we thought It'd be good to have an API (We chose Ruby and Rails for this) and a SPA (built with React and Redux ) connected. We started the SPA with Create React App since It's pretty easy to start.

We use Jest as the testing framework and react-testing-library to test React components. In Rails we make tests using RSpec.

Our main database is PostgreSQL, but we also use MongoDB to store some type of data. We started to use Redis  for cache and other time sensitive operations.

We have a couple of extra projects: One is an Employee app built with React Native and the other is an internal back office dashboard built with Next.js for the client and Python in the backend side.

Since we have different frontend apps we have found useful to have Bit to document visual components and utils in JavaScript.

See more

Blog Posts

Jest's Features

  • Familiar Approach: Built on top of the Jasmine test framework, using familiar expect(value).toBe(other) assertions
  • Mock by Default: Automatically mocks CommonJS modules returned by require(), making most existing code testable
  • Short Feedback Loop: DOM APIs are mocked and tests run in parallel via a small node.js command line utility

Jest Alternatives & Comparisons

What are some alternatives to Jest?
Mocha
Mocha is a feature-rich JavaScript test framework running on node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
Selenium
Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
AVA
Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature. AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file.
Enzyme
Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.
Jasmine
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js projects, or anywhere that JavaScript can run.
See all alternatives

Jest's Followers
3986 developers follow Jest to keep up with related blogs and decisions.