- Now that we understand Jest and what it does,
let's get it installed and set up in our project.
To install Jest,
have your command line open at the root
of the Vue.js project.
To follow along with this video,
you need the 02_01b branch of the project.
So check the branch out of the remote repository using git,
now run the command to install the jest package
as a development dependency.
Now, this process is going to take a while,
so you can take a short break,
maybe check on your emails,
then turn back when it's done.
Now that Jest has been installed into the project,
we can start using it to run our tests.
You can confirm this by running the jest command
at the root of the project.
The output of running jest at this point
indicates that there are no tests currently available
in the project.
The way we just ran jest
is not a standard way we will be running into command,
we'll be creating an NPM script for that.
To add the NPM script,
locate the package.json file in your text editor.
Now add the test script in the script section
and set it to call the jest command,
this way each time we run the test script,
the jest command we'll run.
Let's go ahead and test that out in the CLI.
I do it on the project once again,
run the test script using NPM,
as seen we get the same results as we did
when we just ran the jest command,
but this time we have some errors
coming from NPM terminating the process.
Now you don't have to worry about these errors,
they are completely normal and would no longer show up
once we have test files in the project.