Install Jest — Transcript

Transcript of the free Vue.js lesson Install Jestwatch the video lesson.

In this course, we're going to learn about Jest. For me personally, it's the preferred test runner out there right now when it comes to unit and integration testing. Jest comes with everything we need to run tests on the command line. We have support for commonly used practices like mocking, and it comes with a list of expectation functions that allow us to verify our tests work as expected.

We will dive into those parts in the upcoming videos. Overall, I can say that Jest is an excellent companion when it comes to testing different aspects of Vue. So let's dive into Jest and get comfortable with this magnificent test runner. Here you see the Jest homepage, where you can find all information regarding Jest.

Let's get started with it right now. You can find all necessary instructions on this page, but let's try to set it up together now. Within my terminal, I'm in an empty directory. that we're going to fill with different tests.

The chess test genre runs a node and is used directly from the command line. json file. I'm going to use yarn in these videos, but the eventual commands work the same in npm. json file.

The dash y flag sets all the answers to yes, so we don't have to deal with them. json file in our folder, we are ready to install Jest. This will install the Jest package. It is now ready to use for us by simply typing yarn jest.

We have nothing to run yet, so we can also ignore the output for now. json file and use it through npm alike. The important piece though we should take care of front is to enable support for Babel. as we want to use modern JavaScript capabilities in our spec alongside our code.

This will make Babel run as part of the process in Jest and transpile all spec files accordingly. As a final touch, we want to tell Babel about the current preset. This creates a new file that gets read in by Babel automatically. So let's now tell Babel about our preset.

Now we're good to go and run our first spec. In this course, we're going to learn about Jest. For me personally, it's the preferred test runner out there right now when it comes to unit and integration testing. Jest comes with everything we need to run tests on the command line.

We have support for commonly used practices like mocking, and it comes with a list of expectation functions that allow us to verify our tests work as expected. We will dive into those parts in the upcoming videos. Overall, I can say that Jest is an excellent companion when it comes to testing different aspects of Vue. So let's dive into Jest and get comfortable with this magnificent test runner.

Here you see the Jest homepage, where you can find all information regarding Jest. Let's get started with it right now. You can find all necessary instructions on this page, but let's try to set it up together now. Within my terminal, I'm in an empty directory.

that we're going to fill with different tests. The chess test genre runs a node and is used directly from the command line. json file. I'm going to use yarn in these videos, but the eventual commands work the same in npm.

json file. The dash y flag sets all the answers to yes, so we don't have to deal with them. json file in our folder, we are ready to install Jest. This will install the Jest package.

It is now ready to use for us by simply typing yarn jest. We have nothing to run yet, so we can also ignore the output for now. json file and use it through npm alike. The important piece though we should take care of front is to enable support for Babel.

as we want to use modern JavaScript capabilities in our spec alongside our code. This will make Babel run as part of the process in Jest and transpile all spec files accordingly. As a final touch, we want to tell Babel about the current preset. This creates a new file that gets read in by Babel automatically.

So let's now tell Babel about our preset. Now we're good to go and run our first spec.