Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Test with Jest

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!