From the course: Node.js: Testing and Code Quality

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Install Jest in a Node.js project

Install Jest in a Node.js project

- [Instructor] We've been discussing the tools and theory around writing tests. Let's apply that knowledge by installing Jest. Two steps are necessary for installation. The first thing we need to do is use NPM to install Jest to the project's dev dependencies. Then, we'll edit package.json and add the definition for the test script, which will just be jest. Finally, we'll add an ESLint environment configuration for Jest globals. This isn't strictly required, but it will reduce a number of false positives from the linter. Let's switch over to VS Code. Open a terminal and make sure you're in the project directory. We're going to use NPM to install Jest to the dev dependencies dash capital D. Press Enter. After a moment, Jest and its dependencies will be installed. As we're using Jest for a test framework, we're going to have to add it to the scripts. In the Explorer, open up package.json. Find the script section and…

Contents