Test with Jest
Plans from $25/month

This lesson is for members. Join us?

Subscribe now to get instant access to this course, plus a full library of Vue.js courses tailored to the plan you choose.

🚧 PLEASE NOTE: An updated version of this course is available! see the Rapid Testing with Vitest: Master Unit Testing & Mocking course. This course is outdated!

Install Jest

This course is all about unit testing with Jest and in this lesson, we'll learn how to install Jest in our project.

To get started, we need a package.json. Go to your project directory and run the following commands in your terminal:

yarn init -y
```
Then we need to install Jest:

yarn add --dev jest


Add support for babel:

yarn add --dev babel-core babel-jest babel-preset-env


Create a babel preset file:

touch .babelrc


And add the current preset, to `.babelrc`:

{ "presets": [ "env" ] }


And voilà, Jest is installed!