How To Install mocha on CentOS 7

In this tutorial we learn how to install mocha on CentOS 7. mocha is A simple, flexible, fun test framework for Node.js

Introduction

In this tutorial we learn how to install mocha on CentOS 7.

What is mocha

Mocha is a feature-rich JavaScript test framework running on Node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

We can use yum or dnf to install mocha on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install mocha.

Install mocha on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install mocha using yum by running the following command:

sudo yum -y install mocha

Install mocha on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install mocha using dnf by running the following command:

sudo dnf -y install mocha

How To Uninstall mocha on CentOS 7

To uninstall only the mocha package we can use the following command:

sudo dnf remove mocha

References

Summary

In this tutorial we learn how to install mocha on CentOS 7 using yum and dnf.